You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行flutter run时Gradle构建失败,提示AndroidManifest.xml解析错误及插件相关警告求助

执行flutter run时Gradle构建失败,提示AndroidManifest.xml解析错误及插件相关警告求助

大家好,我在运行flutter run或者flutter run --debug命令时,Gradle构建直接失败了,同时还弹出了一堆插件相关的警告,以下是完整的终端输出日志:

PS C:\Users\useru\Downloads\project\EDITED\flutter_user> flutter run --debug
Launching lib\main.dart on sdk gphone x86 64 in debug mode...
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block.

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block.

Warning: Overriding compileSdk version in Flutter plugin: audioplayers_android from 33 to 34 (to work around a known Android build issue).
If there is not a new version of audioplayers_android, consider filing an issue against audioplayers_android to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: contacts_service from 30 to 34 (to work around a known Android build issue).
If there is not a new version of contacts_service, consider filing an issue against contacts_service to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: flutter_callkit_incoming_fix from 31 to 34 (to work around a known Android build issue).
If there is not a new version of flutter_callkit_incoming_fix, consider filing an issue against flutter_callkit_incoming_fix to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: flutter_native_splash from 31 to 34 (to work around a known Android build issue).
If there is not a new version of flutter_native_splash, consider filing an issue against flutter_native_splash to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: fluttertoast from 33 to 34 (to work around a known Android build issue).
If there is not a new version of fluttertoast, consider filing an issue against fluttertoast to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: geocoding_android from 33 to 34 (to work around a known Android build issue).
If there is not a new version of geocoding_android, consider filing an issue against geocoding_android to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: linphone_flutter_plugin from 31 to 34 (to work around a known Android build issue).
If there is not a new version of linphone_flutter_plugin, consider filing an issue against linphone_flutter_plugin to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: otp_autofill from 33 to 34 (to work around a known Android build issue).
If there is not a new version of otp_autofill, consider filing an issue against otp_autofill to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: package_info_plus from 33 to 34 (to work around a known Android build issue).
If there is not a new version of package_info_plus, consider filing an issue against package_info_plus to increase their compileSdk to the latest (otherwise try updating to the latest version).
Warning: Overriding compileSdk version in Flutter plugin: vibration from 33 to 34 (to work around a known Android build issue).
If there is not a new version of vibration, consider filing an issue against vibration to increase their compileSdk to the latest (otherwise try updating to the latest version).

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> com.android.manifmerger.ManifestMerger2$MergeFailureException: Error parsing C:\Users\useru\Downloads\project\EDITED\flutter_user\android\app\src\main\AndroidManifest.xml

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help via Gradle's official documentation.

BUILD FAILED in 42s
Running Gradle task 'assembleDebug'...                             43,5s
Error: Gradle task assembleDebug failed with exit code 1

我把项目里对应的AndroidManifest.xml文件内容也贴出来了,麻烦大家帮忙看看是不是哪里写错了:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.user.sfrix">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.READ_CONTACTS"/>  
    <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
    <uses-permission android:name="android.permission.CAMERA"/> 
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.READ_SMS"/>
    <uses-permission android:name="android.permission.RECEIVE_SMS"/>
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.SYSTEM_CAMERA" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
    <uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
    <application
        tools:replace="android:label"
        android:label="SFRIX User App"
        android:name="${applicationName}"
        android:icon="@mipmap/ic_launcher">
        <activity
             android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTask"
            android:theme="@style/Theme.AppCompat"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize"
            android:showWhenLocked="true"
            android:turnScreenOn="true"
            android:usesCleartextTraffic="true">
            <!-- 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"
              />
              <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="1" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <meta-data android:name="com.google.android.geo.API_KEY"
               android:value="android map key"/>
        <!-- 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" />
        
        <!-- Ajout de l'Icône dans `android/app/src/main/res/mipmap-&lt;density&gt;/ic_launcher.png` Pour le Package `flutter_local_notifications` -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@mipmap/ic_launcher" />
    </application>
</manifest>

现在我主要困惑的两个点:

  1. 报错只说Manifest解析失败,但没说具体哪里错了,我对着文件看了半天也没发现语法问题,有没有办法定位具体错误?
  2. 那些插件的compileSdk版本被自动从低版本覆盖到34的警告,有没有必要处理?如果要处理的话,除了等插件更新或者提issue,有没有临时的解决办法?

希望有经验的大佬能给点建议,谢谢啦!

备注:内容来源于stack exchange,提问作者user22111293

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 10:38:07