配置just_audio_background遇AndroidManifest解析失败问题求助
AndroidManifest.xml解析失败(Just Audio Background配置问题)
按照just_audio_background插件文档步骤修改android/app/src/main/AndroidManifest.xml后,运行应用时出现编译错误:
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugMainManifest'. > com.android.manifmerger.ManifestMerger2$MergeFailureException: Error parsing /Users/mac/Documents/flutter_projects/zense_timer_project/zense_timer/android/app/src/main/AndroidManifest.xml
已执行flutter clean并重启IDE,但问题未解决。另外,修改Manifest前就存在Unresolved class '{applicationName}'、Cannot resolve symbol '@style/NormalTheme'的警告,但应用可正常编译,怀疑是IDE bug导致。
当前AndroidManifest.xml代码如下:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/> <application android:label="zense_timer" android:name="${applicationName}" android:icon="@mipmap/ic_launcher"> <activity android:name="com.ryanheise.audioservice.AudioServiceActivity" android:exported="true" 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" /> <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 --> <service android:name="com.ryanheise.audioservice.AudioService" android:foregroundServiceType="mediaPlayback" android:exported="true" tools:ignore="Instantiatable"> <intent-filter> <action android:name="android.media.browse.MediaBrowserService" /> </intent-filter> </service> <!-- ADD THIS "RECEIVER" element --> <receiver android:name="com.ryanheise.audioservice.MediaButtonReceiver" android:exported="true" tools:ignore="Instantiatable"> <intent-filter> <action android:name="android.intent.action.MEDIA_BUTTON" /> </intent-filter> </receiver> <meta-data android:name="flutterEmbedding" android:value="2" /> <!-- ADD THIS "SERVICE" element --> </application> </manifest>
(附修改前后Manifest截图)
内容的提问来源于stack exchange,提问作者Kdon
相关产品推荐
相关产品推荐

