android:exported 需要为 <activity> 明确指定。针对 Android 12 及更高版本的应用需要指定

Ash*_*ava 14 java android android-manifest kotlin android-12

升级到 android 12 后,应用程序未编译。表明

“清单合并因多个错误而失败,请参阅日志”

合并清单中显示的错误:

合并错误:错误:android:exported 需要为 明确指定。面向 Android 12 及更高版本的应用需要为android:exported相应组件定义了意图过滤器时指定显式值。有关详细信息,请参阅 https://developer.android.com/guide/topics/manifest/activity-element#exported。主清单(此文件)

我已将所有活动设置为android:exported="false". 但它仍然显示这个问题。

我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="eu.siacs.conversations">

    <uses-sdk tools:overrideLibrary="net.ypresto.androidtranscoder" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission
        android:name="android.permission.READ_PHONE_STATE"
        android:maxSdkVersion="22" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

    <uses-feature
        android:name="android.hardware.location"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.location.gps"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.location.network"
        android:required="false" />

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.camera.autofocus"
        android:required="false" />
    <uses-feature
        android:name="android.hardware.microphone"
        android:required="false" />

    <application
        android:name=".Application"
        android:allowBackup="false"
        android:allowClearUserData="true"
        android:appCategory="social"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_app_launch"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:networkSecurityConfig="@xml/network_security_configuration"
        android:requestLegacyExternalStorage="true"
        android:roundIcon="@mipmap/ic_app_launch_round"
        android:theme="@style/ConversationsTheme"
        android:usesCleartextTraffic="true"
        android:windowSoftInputMode="adjustPan|adjustResize"
        tools:replace="android:label"
        tools:targetApi="q">
        <activity
            android:name=".ui.search.GroupSearchActivity"
            android:exported="true" />
        <activity
            android:name=".ui.profileUpdating.FavouritesActivity"
            android:exported="true" />
        <activity
            android:name=".ui.profileUpdating.NameActivity"
            android:exported="true" />
        <activity
            android:name=".ui.CompulsoryUpdateActivity"
            android:exported="true" />
        <activity android:name=".ui.payments.doPayment.DoPaymentActivity"
            android:exported="true" />
        <activity android:name=".ui.individualList.IndividualListActivity"
            android:exported="true" />
        <activity android:name=".ui.payments.setPayment.SetPaymentActivity"
            android:exported="true" />
        <activity android:name=".ui.login.otpActivity.OTPActivity"
            android:exported="true" />
        <activity android:name=".ui.login.loginActivity.LoginActivity"
            android:exported="true" />

        <service android:name=".services.XmppConnectionService" android:exported="true" />

        <receiver android:name=".services.EventReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
                <action android:name="android.intent.action.ACTION_SHUTDOWN" />
                <action android:name="android.media.RINGER_MODE_CHANGED" />
            </intent-filter>
        </receiver>

        <activity
            android:name=".ui.ShareLocationActivity"
            android:label="@string/title_activity_share_location"
            android:exported="true"/>
        <activity
            android:name=".ui.SearchActivity"
            android:label="@string/search_messages"
            android:exported="true" />
        <activity
            android:name=".ui.RecordingActivity"
            android:configChanges="orientation|screenSize"
            android:theme="@style/ConversationsTheme.Dialog"
            android:exported="true" />
        <activity
            android:name=".ui.ShowLocationActivity"
            android:label="@string/title_activity_show_location"
            android:exported="true" />
        <activity
            android:name=".ui.SplashActivity"
            android:theme="@style/SplashTheme"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.ConversationsActivity"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:minWidth="300dp"
            android:minHeight="300dp"
            android:exported="true"
            android:windowSoftInputMode="stateHidden" />
        <activity
            android:name=".ui.ScanActivity"
            android:screenOrientation="portrait"
            android:exported="true"
            android:theme="@style/ConversationsTheme.FullScreen"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name=".ui.UriHandlerActivity"
            android:label="@string/app_name"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="xmpp" />
            </intent-filter>
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="https" />
                <data android:host="im.app.in" />
                <data android:pathPrefix="/i/" />
                <data android:pathPrefix="/j/" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SENDTO" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:scheme="imto" />
                <data android:host="jabber" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.StartConversationActivity"
            android:label="@string/title_activity_start_conversation"
            android:launchMode="singleTop"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.SettingsActivity"
            android:label="@string/title_activity_settings"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.ChooseContactActivity"
            android:label="@string/title_activity_choose_contact"
            android:exported="true" />
        <activity
            android:name=".ui.BlocklistActivity"
            android:label="@string/title_activity_block_list"
            android:exported="true"/>
        <activity
            android:name=".ui.ChangePasswordActivity"
            android:label="@string/change_password_on_server"
            android:exported="true"/>
        <activity
            android:name=".ui.ChooseAccountForProfilePictureActivity"
            android:enabled="false"
            android:label="@string/choose_account"
            android:exported="true">
            <intent-filter android:label="@string/set_profile_picture">
                <action android:name="android.intent.action.ATTACH_DATA" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="image/*" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.ShareViaAccountActivity"
            android:label="@string/title_activity_share_via_account"
            android:launchMode="singleTop"
            android:exported="true" />
        <activity
            android:name=".ui.EditAccountActivity"
            android:launchMode="singleTop"
            android:exported="true"
            android:windowSoftInputMode="stateHidden|adjustResize" />
        <activity
            android:name=".ui.ConferenceDetailsActivity"
            android:label="@string/action_muc_details"
            android:exported="true"
            android:windowSoftInputMode="stateHidden" />
        <activity
            android:name=".ui.ContactDetailsActivity"
            android:exported="true"
            android:windowSoftInputMode="stateHidden" />
        <activity
            android:name=".ui.PublishProfilePictureActivity"
            android:label="@string/mgmt_account_publish_avatar"
            android:exported="true"
            android:windowSoftInputMode="stateHidden" />
        <activity
            android:name=".ui.PublishGroupChatProfilePictureActivity"
            android:exported="true"
            android:label="@string/group_chat_avatar" />
        <activity
            android:name=".ui.ShareWithActivity"
            android:label="@string/app_name"
            android:launchMode="singleTop"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SEND_MULTIPLE" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="text/plain" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SEND_MULTIPLE" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="*/*" />
            </intent-filter>

            <!-- the value here needs to be the full class name; independent of the configured applicationId -->
            <meta-data
                android:name="android.service.chooser.chooser_target_service"
                android:value="eu.siacs.conversations.services.ContactChooserTargetService" />
        </activity>
        <activity
            android:name=".ui.TrustKeysActivity"
            android:label="@string/trust_omemo_fingerprints"
            android:exported="true"
            android:windowSoftInputMode="stateAlwaysHidden" />
        <activity
            android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
            android:exported="true"
            android:theme="@style/Base.Theme.AppCompat" />
        <activity android:name=".ui.MemorizingActivity"
            android:exported="true" />
        <activity
            android:name=".ui.MediaBrowserActivity"
            android:exported="true"
            android:label="@string/media_browser" />

        <service android:name=".services.ExportBackupService" android:exported="true"/>
        <service android:name=".services.ImportBackupService" android:exported="true"/>
        <service
            android:name=".services.ContactChooserTargetService"
            android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE"
            android:exported="true">
            <intent-filter>
                <action android:name="android.service.chooser.ChooserTargetService" />
            </intent-filter>
        </service>
        <service android:name=".services.CompulsoryUpdateService" android:exported="true"/>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.files"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>
        <provider
            android:name=".services.BarcodeProvider"
            android:authorities="${applicationId}.barcodes"
            android:exported="false"
            android:grantUriPermissions="true" />

        <activity
            android:name=".ui.ShortcutActivity"
            android:label="@string/contact"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.MucUsersActivity"
            android:exported="true"
            android:label="@string/group_chat_members" />
        <activity
            android:name=".ui.ChannelDiscoveryActivity"
            android:exported="true"
            android:label="@string/discover_channels" />
        <activity
            android:name=".ui.RtpSessionActivity"
            android:autoRemoveFromRecents="true"
            android:exported="true"
            android:launchMode="singleInstance"
            android:supportsPictureInPicture="true" />
    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

我的第二个清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="eu.siacs.conversations">

    <application tools:ignore="GoogleAppIndexingWarning">
        <activity
            android:name=".ui.ManageAccountActivity"
            android:label="@string/title_activity_manage_accounts"
            android:launchMode="singleTask"
            android:exported="true"/>
        <activity
            android:name=".ui.MagicCreateActivity"
            android:label="@string/create_new_account"
            android:launchMode="singleTask"
            android:exported="true"/>
        <activity
            android:name=".ui.EasyOnboardingInviteActivity"
            android:label="@string/invite_to_app"
            android:launchMode="singleTask" />
        <activity
            android:name=".ui.ImportBackupActivity"
            android:label="@string/restore_backup"
            android:launchMode="singleTask"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="application/vnd.conversations.backup" />
                <data android:scheme="content" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="application/vnd.conversations.backup" />
                <data android:scheme="file" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="content" />
                <data android:host="*" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.ceb" />
                <data android:pathPattern=".*\\..*\\.ceb" />
                <data android:pathPattern=".*\\..*\\..*\\.ceb" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
                <data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="file" />
                <data android:host="*" />
                <data android:mimeType="*/*" />
                <data android:pathPattern=".*\\.ceb" />
                <data android:pathPattern=".*\\..*\\.ceb" />
                <data android:pathPattern=".*\\..*\\..*\\.ceb" />
                <data android:pathPatt

Ray*_*aga 72

修复此类问题可能有点麻烦,因为 IDE 不提供有关错误的详细信息,它只是告诉您存在一个没有导出参数的 Activity、Receiver 或 Service,但不会告诉您具体是哪一个。正如 Jakos 所建议的,您可以手动检查合并的清单,或使用此脚本以防生成的清单太大。

之后,您可以通过添加导出的属性(如果它是项目的一部分)来修改受影响的条目,或者如果它是库的一部分,则可以使用以下命令覆盖它:

<activity android:name="name_of_the_activity_inside_library>"
    android:exported="false|true"
    tools:node="merge" />
Run Code Online (Sandbox Code Playgroud)

更新: 当针对 android S 时,清单合并任务似乎失败而没有生成清单,并且检测到此问题,因此我的建议是使用低于 31 的 targetSdk 编译应用程序,然后手动或使用脚本检查生成的清单我链接了。(您可以在构建文件夹中或通过检查生成的 apk找到合并的清单)


eri*_*zee 57

targetSdkVersion回 30
你可以compileSdkVersion在 31 离开
然后点击Run

  • 减少 SdkVersion 只会将问题推迟到以后。Google Play 正在强制执行某些 TargetSdkVersion,因此无论如何您都必须在几个月内定位它。以最新版本为目标始终是一个很好的做法,这样您就可以使用 Android 操作系统的最新功能。所以这里的答案不是解决方案,只是一个临时解决方法 (22认同)
  • 嘿埃里克,首先,感谢您成为新贡献者,这是帮助其他人的最佳方式。关于你的答案,如果你能更详细一点就好了,这样别人就能理解答案的深度。大概解释一下,您是如何遇到同样的问题以及如何解决的。 (6认同)
  • 在这里,先生,你把这个掉了。 (2认同)

Sab*_*aba 34

对于仪器测试,如果您使用 compose 测试,请确保androidx.test.ext:junit除了 compose.ui 依赖项之外还添加

androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.4"
Run Code Online (Sandbox Code Playgroud)


Bui*_*d3r 29

构建失败后,转到 AndroidManifest.xml,然后在底部单击合并清单,查看哪些活动具有intent-filter但不具有exported=true属性。或者您可以只获取出现错误的活动。

android:exported="true"将这些活动添加到您的应用程序清单中,tools:node="merge"这会将导出的属性添加到出现错误的活动中。例子:

     <activity
                android:name="<activity which is giving error>"
                android:exported="true"
                tools:node="merge" />
Run Code Online (Sandbox Code Playgroud)

您必须执行此操作一次,一旦库开发人员更新了他们的库,您就可以将其删除。


Ben*_*Ben 24

检查您的build.gradle文件:

debugImplementation "androidx.fragment:fragment-testing:<version>"
Run Code Online (Sandbox Code Playgroud)

如果存在,请将其更改为:

androidTestImplementation "androidx.fragment:fragment-testing:<version>"
Run Code Online (Sandbox Code Playgroud)

它应该一直是这样androidTestImplementation,但之前存在一些依赖性问题,因此有必要将其用作解决debugImplementation方法。IDE 实际上会提示您执行此操作。但显然它已针对 SDK 31 进行了修复,如果将其保留为 debugImplementation,则会收到android:exported来自manifest.xml依赖包中的 -missing manifest 错误。

  • 解决了一个问题,但出现了一个新问题:我的测试失败,并显示“无法解析活动:Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]... androidx.fragment” .app.testing.FragmentScenario$EmptyFragmentActivity(有额外内容)}` (4认同)
  • 我对此赞不绝口。我花了几个小时寻找这个解决方案。进行了您建议的更改,我的应用程序立即启动。 (3认同)

小智 17

由于目标 sdk 更新到 31 android 12,因此您必须在 manifest.xml 的活动午餐程序中进行 android 导出

 android:exported="true"
Run Code Online (Sandbox Code Playgroud)


Gor*_*ail 17

我的例子中的问题是 test:core:1.3.0 (参见屏幕截图)。

我必须覆盖该库的清单条目并声明该android:exported属性:

<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="true"
tools:node="merge"/>

<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="true"
tools:node="merge"/>

<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="true"
tools:node="merge"/>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  • 这就是我的情况!我通过将 androidx.test:core 的版本切换到最新版本 1.4.0 解决了这个问题。该解决方案不需要任何硬代码覆盖(以及任何其他库更新/文件修改),在这种情况下,它更好 (3认同)
  • 这就是我的情况!我通过将“androidx.test.ext:junit”的版本切换为“1.1.3”解决了这个问题。该解决方案不需要任何硬代码覆盖(以及任何其他库更新/文件修改),在这种情况下,它更好 (2认同)

小智 12

<activity
     android:name=".MainActivity"
     android:exported="true" <** add this line on AndroidManifest.xml**
     android:launchMode="singleTop"
     android:theme="@style/LaunchTheme"
 </activity>
Run Code Online (Sandbox Code Playgroud)


小智 10

我不确定您使用什么来编码,但为了在 Android Studio 中设置它,请打开项目的清单,然后在“活动”部分下,输入android:exported="true"(如果是的话,则输入 false是你喜欢的)。我附上了一个例子。

  • 我已将其添加到所有活动中,但问题仍然存在。 (12认同)

Ame*_*bak 9

如果您使用的是 flutter,升级flutter_local_notifications到最新版本(现在是 9.3.2)可能会解决此错误。

  • 这正是我的问题。多谢! (3认同)

小智 7

如果您的应用面向 Android 12 或更高版本,则必须在应用的清单文件中声明这些属性标签。如果应用程序组件包含 LAUNCHER 类别,请将 android:exported 设置为 true。

 <activity
        android:name="com.test.activity.SplashActivity"
        android:clearTaskOnLaunch="true"
        android:label="@string/app_name"
        android:launchMode="singleTop"
        android:noHistory="true"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme.NoActionBar"
        android:exported="true">
Run Code Online (Sandbox Code Playgroud)

如果您使用任何接收器或服务,请检查 Androidmanifest 中的接收器或服务,并根据要求设置 android:exported="true" 或 false。

   <receiver
        android:name="com.test.receiver.ShareReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.test.fcm.android.action.broadcast" />
        </intent-filter>
    </receiver>

   <service
        android:name="com.google.android.gms.tagmanager.InstallReferrerService"
        android:exported="true" />
Run Code Online (Sandbox Code Playgroud)

还要更新所有 gradle 依赖项。

我已根据要求更新了以下依赖项。

testImplementation 'junit:junit:4.13.2' 
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
Run Code Online (Sandbox Code Playgroud)

希望它也能帮助您。


Nek*_*cer 5

我遇到了这个问题,我使用的库之一没有正确设置它。

您可以通过执行以下步骤找到它:

  • 将目标 SDK 设置为 30
  • 转到合并的清单: Android Studio 中的合并清单
  • 查找是否有任何未exported设置的活动、服务、接收器或提供者
  • 为 31 设置目标 SDK
  • 覆盖您找到的所有条目,如下所示:
<receiver android:name="<name_of_the_entry>"
                android:exported="false or true"
                tools:node="merge" />
Run Code Online (Sandbox Code Playgroud)

  • 完成一个干净的项目后,错误将再次出现:( (3认同)
  • @AbdulmalekDery 看看我的答案,你不会修改临时文件中的清单。您必须为“manifest.xml”中的所有条目添加“tools:node="merge"”条目 (3认同)
  • 那么您还有一些未导出的条目。检查所有条目了吗?广播接收者、服务、活动和提供商? (2认同)

raj*_*dia 5

我碰巧特别知道 android 12 中的这个问题。Android SDK 中已经存在一个错误。在您的问题的解决方案中,您可以在 android studio 中添加一个文件并运行该方法。

启用 Android 导出文件

然后运行 ​​def 方法并尝试构建。这是经过尝试和测试的工作方法。


小智 5

如果您确定将导出添加到清单文件中的每个元素但仍然收到此错误,只需:

  1. 切换到项目目录并在 app\build\intermediates\merged_manifest 中打开合并清单文件
  2. 搜索任何包含意图过滤器且没有导出属性的组件
  3. 通过将其复制到主清单文件中来覆盖清单文件中的此组件

提示:如果找不到合并文件,因为它已经无法生成它。暂时降级到 targetSdkVersion 30 并编译 SdkVersion 30 并构建项目以生成此文件,然后按照上述步骤操作,然后升级到 31 (android 12)


dan*_*lad 5

这是升级 TargetSDK 32 或 Android Studio 并支持 API Android 12 后最常见的问题。

关联这是我的错误:

在此输入图像描述

错误是:

 Error:
    android:exported needs to be explicitly specified for element <receiver#com.onesignal.BootUpReceiver>. 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.
D:\iptvapp\iptvapp\app\src\main\AndroidManifest.xml:99:9-103:20 Error:
    android:exported needs to be explicitly specified for element <receiver#com.onesignal.UpgradeReceiver>. 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.
Run Code Online (Sandbox Code Playgroud)

然后通过在库上使用合并的 Mainfest Clikc,该库存在 instacne Onesingal 错误。

在此输入图像描述

然后复制错误(如果是接收器部分)并将其添加到您的主清单文件中,如下所示

安卓:导出

设置为真。

还有他们

 <receiver android:name="com.onesignal.BootUpReceiver"  android:exported="true">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                    <action android:name="android.intent.action.QUICKBOOT_POWERON" />
                </intent-filter>
            </receiver>
            <receiver android:name="com.onesignal.UpgradeReceiver" android:exported="true" >
                <intent-filter>
                    <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
                </intent-filter>
            </receiver>
Run Code Online (Sandbox Code Playgroud)

很有魅力!


归档时间:

查看次数:

2442 次

最近记录:

4 年,4 月 前