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