Unresolved class 'MainActivity'

324

A good AndroidManifest.xml file looks like so

?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="your.package.name">

<uses-permission android:name="android.permission.INTERNET" /> <!--Your permissions-->

<application
        android:name=".common.MyApplication"
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="${appIcon}" <!--Link to your app icon-->
        ...
<!--Activities go here-->
 <activity
            android:name=".view.activity.AgreementDetails"
            android:configChanges="locale|orientation|keyboardHidden"
            android:windowSoftInputMode="adjustResize" />

</application>    

</manifest>

The important things to be noted are whether or not you use the correct values inside the correct tags, for example, the properties in the <application> tag won't work inside the <activity> tag. Also look around if you have closed all the tags. You can close the tags in two ways. Look carefully how the different properties are written

<activity android:label="xyz" android:orientation="landscape">
// Your intent related parameters here
</activity>

Or

<activity android:label="xyz" android:orientation="landscape"/> <!--Notice the tag is close inline here-->
Share:
324
How About That
Author by

How About That

Updated on January 01, 2023

Comments

  • How About That
    How About That over 1 year

    I tried various ways to solve this problem but nothing worked for me. Here is place where I have errors in AndroidManifest.xml:

     android:label="cartoon_magic"
            android:icon="@mipmap/ic_launcher">
            <activity
                android:name=".MainActivity"
                android:launchMode="singleTop"
                android:theme="@style/LaunchTheme"
                android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
                android:hardwareAccelerated="true"
                android:windowSoftInputMode="adjustResize">
    
    Attribute android:icon is not allowed here
    Unresolved class 'MainActivity'
    Attribute android:launchMode is not allowed here
    Attribute android:theme is not allowed here
    Attribute android:configChanges is not allowed here
    Attribute android:hardwareAccelerated is not allowed here
    Attribute android:windowSoftInputMode is not allowed here
    

    I guess there is a problem with import io.flutter.embedding.android.FlutterActivity, but I have no idea how to fix it.

    Here is my MainActivity.kt

    package com.example.cartoon_magic
    
    import io.flutter.embedding.android.FlutterActivity
    
    class MainActivity: FlutterActivity() {
    }
    
    

    Here is structure of project:

    project structure

    I am completely confused and do not know in which direction to look for the problem. Thanks for the help!

  • How About That
    How About That over 2 years
    I downloaded project from here: github.com/retroportalstudio/flutter_gallery_storage And I still have same errors. I think the problem is not with the AndroidManifest.xml itself.