繁体   English   中英

Flutter AndroidManifest 错误

[英]Flutter AndroidManifest Error

我刚刚将一个在早期版本的 Flutter 和 Android Studio 中构建的项目移植到新机器和更新的软件上。 尝试在模拟器中构建我的 Android 项目时,我收到以下错误...

  • 出了什么问题:任务 ':app:processDebugManifest' 执行失败。

    清单合并失败:属性 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)。 建议:将 'tools:replace="android:value"' 添加到 AndroidManifest.xml:26:9-28:38 的元素以覆盖。

这就是我的清单的样子......

<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>

我添加了建议的tools:replace="android:value"并且我仍然遇到同样的错误。 我见过类似的问题,只有 Android Studio。 我将此添加到 SO 中,因为我认为它可能与我的 Flutter 构建有关。

我也有同样的问题。 我通过应用错误消息中的建议解决了这个问题。 在 (\\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">

并且不要忘记添加这样的工具:

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

我也有这个问题,但我通过这个解决了。 转到项目目录/构建,然后您将看到 google_sign_in、image_picker、firebase 文件夹或任何已安装的依赖项。 删除它们。 返回 pubspec 文件,再次执行 Packages get 和 Packages upgrade。

问题可能是 image_picker 文件夹,删除 image_picker 就足够了。 如果这确实解决了您的问题,请查看 manifest-merger-debug-report.txt,您将看到原因。 希望你的问题得到解决。

当我尝试将 AWS Datastore 添加到我的 Flutter 项目时,我遇到了这个问题,该项目已经有用于本地 OCR 的 Google MLKit。 Datastore 或 MLKit 都可以,但不能同时使用。

什么对我有用:

将以下内容添加到 app\\src\\main\\AndroidManifest.xml

tools:replace="android:name"

在 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM