Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Overlay manifest:package atribute declared at AndroidManifest.xml:2:5-34. Flutter

Simple Proplem, hard to solve (i think),

I get this error when i start my main.dart:

Error:
    Overlay manifest:package attribute declared at AndroidManifest.xml:2:5-34 value=(com.example.Scanner)
    has a different value=(com.example.Scanner) declared in main manifest at AndroidManifest.xml:1:70-97
    Suggestion: remove the overlay declaration at AndroidManifest.xml   and place it in the build.gradle:
        flavorName {
            applicationId = "com.example.Scanner"
        }

FAILURE: Build failed with an exception.

This is my build.gradle:

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId="com.example.Scanner"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

and this is my AndroidManifest.xml:

package="com.example.Scanner">

I hope someone can help me, otherwise i can´t program at this app anymore :(

After removing package="com.example.Scanner"i get this error:

Launching lib\main.dart on PCT L29 in debug mode...
lib\main.dart:1
√ Built build\app\outputs\flutter-apk\app-debug.apk.
E/AndroidRuntime(18958): FATAL EXCEPTION: main
E/AndroidRuntime(18958): Process: com.example.Scanner, PID: 18958
E/AndroidRuntime(18958): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.Scanner/your_package_name.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "your_package_name.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.Scanner-qq9H2h8k4abCggEZ2-z28Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.Scanner-qq9H2h8k4abCggEZ2-z28Q==/lib/arm64, /data/app/com.example.Scanner-qq9H2h8k4abCggEZ2-z28Q==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]
E/AndroidRuntime(18958):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3813)
E/AndroidRuntime(18958):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4074)
E/AndroidRuntime(18958):    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
E/AndroidRuntime(18958):    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
E/AndroidRuntime(18958):    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
E/AndroidRuntime(18958):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473)
E/AndroidRuntime(18958):    at android.os.Handler.dispatchMessage(Handler.java:110)
E/AndroidRuntime(18958):    at android.os.Looper.loop(Looper.java:219)
E/AndroidRuntime(18958):    at android.app.ActivityThread.main(ActivityThread.java:8347)
E/AndroidRuntime(18958):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18958):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
E/AndroidRuntime(18958):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
E/AndroidRuntime(18958): Caused by: java.lang.ClassNotFoundException: Didn't find class "your_package_name.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.Scanner-qq9H2h8k4abCggEZ2-z28Q==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.Scanner-qq9H2h8k4abCggEZ2-z28Q==/lib/arm64, /data/app/com.example.Scanner-qq9H2h8k4abCggEZ2-z28Q==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]
E/AndroidRuntime(18958):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:209)
E/AndroidRuntime(18958):    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(18958):    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(18958):    at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
E/AndroidRuntime(18958):    at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:41)
E/AndroidRuntime(18958):    at android.app.Instrumentation.newActivity(Instrumentation.java:1264)
E/AndroidRuntime(18958):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3798)
E/AndroidRuntime(18958):    ... 11 more

like image 239
Vito Avatar asked Oct 19 '25 04:10

Vito


1 Answers

This shows the 3 Android files that stores - Android Manifest Files

I had the same issue, and I changed the package name in 5 locations.

  1. android/app/src/debug/AndroidManifest.xml

  2. android/app/src/main/AndroidManifest.xml

  3. android/app/src/profile/AdroidManifest.xml

  4. buildgradle file defaultConfig { applicationId ""}

  5. MainActivity.java on "package" OR MainActivity.kotlin

After modifying the above files, the Flutter App ran without any issues.

like image 177
Scarlet Scherzinger Avatar answered Oct 20 '25 17:10

Scarlet Scherzinger