简体   繁体   English

"我设置了 android:exported 但我仍然收到错误:android:exported 需要明确指定<receiver>"

[英]I set android:exported but I am still getting error: android:exported needs to be explicitly specified for <receiver>

I am moving from SDK version 30 to 31 and I add android:exported in intent-filter but still I am getting this error:我正在从 SDK 版本 30 迁移到 31,并在意图过滤器中添加 android:exported 但仍然收到此错误:

Merging Errors: Error: android:exported needs to be explicitly specified for .合并错误:错误:需要为 . Apps targeting Android 12 and higher are required to specify an explicit value for android:exported<\/code> when the corresponding component has an intent filter defined.面向 Android 12 及更高版本的应用需要为android:exported<\/code>指定显式值,前提是相应组件定义了 Intent 过滤器。 See https:\/\/developer.android.com\/guide\/topics\/manifest\/activity-element#exported<\/a> for details.有关详细信息,请参阅https:\/\/developer.android.com\/guide\/topics\/manifest\/activity-element#exported<\/a> 。

<?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="com.mycompany.webviewapp">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

    <application
        android:name=".App"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713"/>

        <activity android:name="com.mycompany.webviewapp.SplashActivity"
            android:exported="true"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.mycompany.webviewapp.MainActivity"
            android:exported="true"
            android:screenOrientation="portrait">
            <intent-filter>
                <category android:name="android.intent.category.LAUNCHER"/>
                <action android:name="android.intent.action.VIEW"></action>
            </intent-filter>

        </activity>

        <service android:name="com.mycompany.webviewapp.FCM.MyFirebaseMessagingService">

        </service>

        <meta-data android:name="applovin.sdk.key"
            android:value="sdk api here"/>

    </application>

</manifest>

The reason is because some of the dependency libraries that you're using have elements which do not have "android:exported" attribute.原因是您使用的某些依赖库的元素没有“android:exported”属性。

You need to do this:你需要这样做:

  • Lower the version in your gradle to 30 and sync and build.将 gradle 中的版本降低到 30 并同步和构建。<\/li>
  • Go to your AndroidManifest.xml file and click on "Merged Manifest".转到您的 AndroidManifest.xml 文件并单击“Merged Manifest”。<\/li>
  • Find items such as Activity, Receiver, Service, etc that don't have "android:exported" attribute.查找诸如 Activity、Receiver、Service 等没有“android:exported”属性的项目。<\/li>
  • Then add them to your AndroidManifest.xml file in this way.然后以这种方式将它们添加到您的 AndroidManifest.xml 文件中。<\/li><\/ul>
     <activity android:name="SomeActivity" android:exported="false" tools:node="merge" tools:replace="android:exported" \/><\/code><\/pre>

    Now you can increase your version to 31.现在您可以将版本增加到 31。

    "

I resolve my issue.我解决了我的问题。 I just check the merged manifest and look for reciver.我只是检查合并的清单并寻找接收者。 In onesignal, I found out reciver with intent filter defined without android:exported.在 onesignal 中,我发现了带有未定义 android:exported 的意图过滤器的接收器。 I just add android:exported="false".我只是添加了 android:exported="false"。

"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Manifest合并失败:android:exported needs to be explicitly specified for<receiver></receiver> - Manifest merger failed : android:exported needs to be explicitly specified for <receiver> android:exported 需要明确指定<activity></activity> - android:exported needs to be explicitly specified for <activity> android:exported 需要明确指定<receiver> . 在 Flutter 中面向 Android 12 及更高版本的应用 - android:exported needs to be explicitly specified for <receiver>. Apps targeting Android 12 and higher In Flutter android:exported 需要明确指定<service> . 针对 Android 12 的应用程序</service> - android:exported needs to be explicitly specified for <service>. Apps targeting Android 12 清单合并失败:需要明确指定 android:exported<activity> - Manifest merger failed : android:exported needs to be explicitly specified for <activity> android:exported 需要明确指定<activity> . 针对 Android 12 及更高版本的应用需要指定</activity> - android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify Android:exported 需要明确指定<service> .针对 Android 12 及更高版本的应用程序</service> - Android:exported needs to be explicitly specified for <service>.Apps targeting Android 12 and higher 清单合并失败:需要为元素显式指定 android:exported <service#com.marianhello.bgloc.sync.authenticatorservice></service#com.marianhello.bgloc.sync.authenticatorservice> - Manifest merger failed : android:exported needs to be explicitly specified for element <service#com.marianhello.bgloc.sync.AuthenticatorService> Android:OnBootReceiver:导出的接收器不需要许可 - Android: OnBootReceiver: Exported receiver does not require permission 我在 Android IDE 上错误地指定了 VM 选项 - I am getting error improperly specified VM option on Android IDE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM