如何解释Android Studio中的“合并清单”内容以修复Android Studio中的错误“Manifest merge failed with multiple errors”?

xfb7svmp  于 2024-01-04  发布在  Android
关注(0)|答案(1)|浏览(177)

我从build.gradle文件中将我的应用从targetsdk版本30更改为33,minsdk更改为21,但当我尝试构建apk时,我收到错误“Manifest merger failed with multiple errors,see logs”。我如何理解我的AndroidManifest.xml和下面显示的“merged manifest”结果内容来解决这个问题?
这是“合并清单”选项卡内容的错误

  1. Merge Errors Error: android:exported needs to be explicitly specified for element <activity#id.platinum.android.feature.splash.SplashActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. lovpos_f.app main manifest (this file), line 79 Error: android:exported needs to be explicitly specified for element <receiver#com.freshchat.consumer.sdk.receiver.FreshchatReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. lovpos_f.app main manifest (this file) Error: android:exported needs to be explicitly specified for element <receiver#com.freshchat.consumer.sdk.receiver.FreshchatNetworkChangeReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. lovpos_f.app main manifest (this file) Merge Warnings Warning: Element uses-permission#android.permission.BLUETOOTH at AndroidManifest.xml:12:5-68 duplicated with element declared at AndroidManifest.xml:5:5-68 lovpos_f.app main manifest (this file), line 11

字符串
本文摘自AndroidManifest.xml

  1. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  2. package="id.platinum.android"
  3. xmlns:tools="http://schemas.android.com/tools">
  4. <uses-permission android:name="android.permission.BLUETOOTH" />
  5. <uses-permission android:name="android.permission.INTERNET" />
  6. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  7. <uses-permission android:name="android.permission.CAMERA" />
  8. <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  9. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  10. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  11. <uses-permission android:name="android.permission.BLUETOOTH" />
  12. <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
  13. <uses-feature
  14. android:name="android.hardware.camera"
  15. android:required="true" />
  16. <application
  17. android:name="id.platinum.android.MyApplication"
  18. android:allowBackup="true"
  19. android:hardwareAccelerated="true"
  20. android:icon="@mipmap/ic_launcher"
  21. android:roundIcon="@mipmap/ic_launcher"
  22. android:label="@string/app_name"
  23. android:largeHeap="true"
  24. android:networkSecurityConfig="@xml/network_security_config"
  25. android:supportsRtl="true"
  26. android:theme="@style/AppTheme"
  27. android:requestLegacyExternalStorage="true"
  28. android:usesCleartextTraffic="true"
  29. tools:targetApi="n">
  30. <!-- This meta-data tag is required to use Google Play Services. -->
  31. <meta-data
  32. android:name="com.google.android.gms.version"
  33. android:value="@integer/google_play_services_version" />
  34. <meta-data
  35. android:name="com.google.android.gms.ads.AD_MANAGER_APP"
  36. android:value="true"/>
  37. <activity
  38. android:name="com.google.android.gms.ads.AdActivity"
  39. android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
  40. android:theme="@android:style/Theme.Translucent" />
  41. <meta-data
  42. android:name="firebase_crashlytics_collection_enabled"
  43. android:value="${crashlyticsEnabled}"/>
  44. <meta-data
  45. android:name="com.google.firebase.messaging.default_notification_icon"
  46. android:resource="@drawable/ic_logo_white"/>
  47. <meta-data
  48. android:name="com.google.firebase.messaging.default_notification_color"
  49. android:resource="@color/colorPrimary"/>
  50. <meta-data
  51. android:name="com.google.firebase.messaging.default_notification_channel_id"
  52. android:value="@string/default_notification_channel_id"/>
  53. <provider
  54. android:name="androidx.core.content.FileProvider"
  55. android:authorities="id.platinum.android.provider"
  56. android:exported="false"
  57. android:grantUriPermissions="true">
  58. <meta-data
  59. android:name="android.support.FILE_PROVIDER_PATHS"
  60. android:resource="@xml/file_paths"
  61. tools:replace="android:resource" />
  62. </provider>
  63. <service
  64. android:name="id.platinum.android.services.notification.FirebaseMessagingService"
  65. android:exported="false">
  66. <intent-filter>
  67. <action android:name="com.google.firebase.MESSAGING_EVENT"/>
  68. </intent-filter>
  69. </service>

nqwrtyyt

nqwrtyyt1#

日志显示您必须将导出的属性添加到<activity#id.platinum.android.feature.splash.SplashActivity>
这可能是您的SplashActivity,您发布的代码中缺少此Activity的代码。检查您是否将此Activity添加到您的清单中,如果是,请添加导出属性。

相关问题