简体   繁体   English

Flutter AndroidManifest 错误

[英]Flutter AndroidManifest Error

I just ported a project built in an earlier version of Flutter and Android studio to a new machine and updated software.我刚刚将一个在早期版本的 Flutter 和 Android Studio 中构建的项目移植到新机器和更新的软件上。 When attempting to build my Android project in the emulator, I'm getting the following error...尝试在模拟器中构建我的 Android 项目时,我收到以下错误...

  • What went wrong: Execution failed for task ':app:processDebugManifest'.出了什么问题:任务 ':app:processDebugManifest' 执行失败。

    Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35 is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).清单合并失败:属性 meta-data#android.support.VERSION@value value=(25.4.0) from [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35 也是目前在 [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0)。 Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:26:9-28:38 to override.建议:将 'tools:replace="android:value"' 添加到 AndroidManifest.xml:26:9-28:38 的元素以覆盖。

This is what my Manifest looks like...这就是我的清单的样子......

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.myfavkpopflutterexample"
 xmlns:tools="http://schemas.android.com/tools"
>

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="21" />

<!-- The INTERNET permission is required for development. Specifically,
     flutter needs it to communicate with the running application
     to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>

<!-- 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="myfavkpopflutter_example" android:icon="@mipmap/ic_launcher">
    <activity android:name=".MainActivity"
              android:launchMode="singleTop"
              android:theme="@android:style/Theme.Black.NoTitleBar"
              android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
              android:hardwareAccelerated="true"
              android:windowSoftInputMode="adjustResize">
        <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                tools:replace="android:value"
                android:value="true" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
</application>

I've added the suggested tools:replace="android:value" and I'm still getting same error.我添加了建议的tools:replace="android:value"并且我仍然遇到同样的错误。 I've seen similar questions that was Android Studio only.我见过类似的问题,只有 Android Studio。 I'm adding this to SO because I think it may be related to my Flutter build.我将此添加到 SO 中,因为我认为它可能与我的 Flutter 构建有关。

I have the same problem too.我也有同样的问题。 I resolved the problem by applying the suggestion in error message.我通过应用错误消息中的建议解决了这个问题。 Adding tools:replace="android:label" in (\\android\\app\\src\\main\\AndroidManifest.xml) add tools:replace="android:label" like this:在 (\\android\\app\\src\\main\\AndroidManifest.xml) 中添加 tools:replace="android:label" 像这样添加 tools:replace="android:label":

<application
    tools:replace="android:label"
    android:name="io.flutter.app.FlutterApplication"
    android:label="flutterwp" 
    android:icon="@mipmap/ic_launcher">

and don't forget add tools like this:并且不要忘记添加这样的工具:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.wp"
xmlns:tools="http://schemas.android.com/tools">

I had this issue too but I solved by this.我也有这个问题,但我通过这个解决了。 Go to project directory/build, then you will see google_sign_in, image_picker, firebase folder, or any installed dependencies.转到项目目录/构建,然后您将看到 google_sign_in、image_picker、firebase 文件夹或任何已安装的依赖项。 Delete them.删除它们。 Go back to the pubspec file, do the Packages get and Packages upgrade again.返回 pubspec 文件,再次执行 Packages get 和 Packages upgrade。

The issue may be the image_picker folder, which deleting image_picker is good enough.问题可能是 image_picker 文件夹,删除 image_picker 就足够了。 If this is really the solved your issue, check out the manifest-merger-debug-report.txt, you will see the reason why.如果这确实解决了您的问题,请查看 manifest-merger-debug-report.txt,您将看到原因。 Hope your issue is solved.希望你的问题得到解决。

I had this issue when I was trying to add AWS Datastore to my Flutter project that already had Google MLKit for local OCR.当我尝试将 AWS Datastore 添加到我的 Flutter 项目时,我遇到了这个问题,该项目已经有用于本地 OCR 的 Google MLKit。 Either Datastore or MLKit would work, but not both together. Datastore 或 MLKit 都可以,但不能同时使用。

What worked for me:什么对我有用:

Adding the following to the app\\src\\main\\AndroidManifest.xml将以下内容添加到 app\\src\\main\\AndroidManifest.xml

tools:replace="android:name"

with the following declaration in AndroidManifest -在 AndroidManifest 中有以下声明 -

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ABC"
xmlns:tools="http://schemas.android.com/tools">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AndroidManifest错误 - AndroidManifest error Flutter App 中的 AndroidManifest.xml 错误“未找到属性 class” - Error in AndroidManifest.xml in Flutter App "Attribute class not Found" 依赖项/ AndroidManifest错误 - dependencies/AndroidManifest error AndroidManifest.xml中的错误 - Error in AndroidManifest.xml 错误 androidmanifest.xml - error androidmanifest.xml Flutter 错误:任务“:app:generateDebugBuildConfig”执行失败。 (/android/app/src/main/AndroidManifest.xml 中的问题) - Flutter error : Execution failed for task ':app:generateDebugBuildConfig'. (problem in /android/app/src/main/AndroidManifest.xml ) 我的flutter项目升级到最新版本后出现AndroidManifest.xml错误 - AndroidManifest.xml error after upgrading to the latest version in my flutter project “运行 com.example.flutter_launcher 时出错。未找到默认活动”更改 AndroidManifest 后 - "Error running com.example.flutter_launcher. Default activity not found" after changing AndroidManifest 错误:覆盖清单:package 在 AndroidManifest.xml:2:5-34 声明的属性。 Flutter - Error: Overlay manifest:package atribute declared at AndroidManifest.xml:2:5-34. Flutter 如何解决我的 flutter 应用程序的 androidmanifest.xml 中的此 firebase 消息传递错误? - How do I resolve this firebase messaging error in the androidmanifest.xml of my flutter application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM