Error: Overlay manifest:package atribute declared at AndroidManifest.xml:2:5-34. Flutter
Error: Overlay manifest:package atribute declared at AndroidManifest.xml:2:5-34. Flutter
简单的问题,
很难解决(我认为),
我在启动 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.
这是我的 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
}
这是我的 AndroidManifest.xml:
package="com.example.Scanner">
我希望有人能帮助我,否则我不能再在这个应用程序上编程了:(
删除后 package="com.example.Scanner"
我得到这个错误:
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
来自 Midhun MP [https://whosebug.com/users/1104384/midhun-mp] 的工作:
Remove the package attribute from androidmanifest and check
我犯了一个错误。然后我得到一个新的 java 错误。我只将一个 AndroidManifest.xml 从一个旧项目复制到一个新项目并且它有效。这对我有用:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Scanner">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Scanner"
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">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
,但我不知道出了什么问题。我从来没有改变过它。
只需更改 package="com.example.YOURNAME">
和 android:label="YOURNAME"
首先使所有包名称相同//要执行此操作,请在终端中显示的搜索栏中搜索您的包名称并修复它们//
然后 运行 flutter clean 和 flutter pub get。
现在你可以 运行 flutter 运行 了。我想它会解决你的问题。
简单的问题, 很难解决(我认为),
我在启动 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.
这是我的 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
}
这是我的 AndroidManifest.xml:
package="com.example.Scanner">
我希望有人能帮助我,否则我不能再在这个应用程序上编程了:(
删除后 package="com.example.Scanner"
我得到这个错误:
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
来自 Midhun MP [https://whosebug.com/users/1104384/midhun-mp] 的工作:
Remove the package attribute from androidmanifest and check
我犯了一个错误。然后我得到一个新的 java 错误。我只将一个 AndroidManifest.xml 从一个旧项目复制到一个新项目并且它有效。这对我有用:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.Scanner">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Scanner"
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">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
,但我不知道出了什么问题。我从来没有改变过它。
只需更改 package="com.example.YOURNAME">
和 android:label="YOURNAME"
首先使所有包名称相同//要执行此操作,请在终端中显示的搜索栏中搜索您的包名称并修复它们// 然后 运行 flutter clean 和 flutter pub get。 现在你可以 运行 flutter 运行 了。我想它会解决你的问题。