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

xfb7svmp  于 12个月前  发布在  Android
关注(0)|答案(1)|浏览(157)

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

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

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

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

    <uses-feature
            android:name="android.hardware.camera"
            android:required="true" />

    <application
            android:name="id.platinum.android.MyApplication"
            android:allowBackup="true"
            android:hardwareAccelerated="true"
            android:icon="@mipmap/ic_launcher"
            android:roundIcon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:largeHeap="true"
            android:networkSecurityConfig="@xml/network_security_config"
            android:supportsRtl="true"
            android:theme="@style/AppTheme"
            android:requestLegacyExternalStorage="true"
            android:usesCleartextTraffic="true"
            tools:targetApi="n">


        <!-- This meta-data tag is required to use Google Play Services. -->
        <meta-data
                android:name="com.google.android.gms.version"
                android:value="@integer/google_play_services_version" />
        <meta-data
                android:name="com.google.android.gms.ads.AD_MANAGER_APP"
                android:value="true"/>
        <activity
                android:name="com.google.android.gms.ads.AdActivity"
                android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
                android:theme="@android:style/Theme.Translucent" />

        <meta-data
                android:name="firebase_crashlytics_collection_enabled"
                android:value="${crashlyticsEnabled}"/>
        <meta-data
                android:name="com.google.firebase.messaging.default_notification_icon"
                android:resource="@drawable/ic_logo_white"/>
        <meta-data
                android:name="com.google.firebase.messaging.default_notification_color"
                android:resource="@color/colorPrimary"/>
        <meta-data
                android:name="com.google.firebase.messaging.default_notification_channel_id"
                android:value="@string/default_notification_channel_id"/>

        <provider
                android:name="androidx.core.content.FileProvider"
                android:authorities="id.platinum.android.provider"
                android:exported="false"
                android:grantUriPermissions="true">
            <meta-data
                    android:name="android.support.FILE_PROVIDER_PATHS"
                    android:resource="@xml/file_paths"
                    tools:replace="android:resource" />
        </provider>

        <service
                android:name="id.platinum.android.services.notification.FirebaseMessagingService"
                android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT"/>
            </intent-filter>
        </service>

nqwrtyyt

nqwrtyyt1#

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

相关问题