简体   繁体   English

android:exported 需要明确指定<service></service>

[英]android:exported needs to be explicitly specified for <service>

I am getting this error when I am upgrading my react-native version from 0.66.2 to 0.68.2 .当我将 react-native 版本从0.66.2升级到0.68.2时,出现此错误。

Error错误

Manifest merger failed: android:exported needs to be explicitly specified for.清单合并失败:android:exported 需要明确指定。 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.当相应组件定义了意图过滤器时,需要针对 Android 12 及更高版本的应用程序为android:exported指定显式值。 See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.有关详细信息,请参阅https://developer.android.com/guide/topics/manifest/activity-element#exported

In the latest version of Android, we need to explicitly define the value for android:exported for all the service and activity in AndroidManifest.xml file.在最新版本的 Android 中,我们需要为AndroidManifest.xml文件中的所有服务活动显式定义android:exported的值。

For example:例如:

 <service android:exported="false" android:name="serviceName" />

If you setting android:exported but it doesn't work, when you open AndroidManifest.xml in Android Studio , you will see a tab called Merged Manifest .如果您设置 android:exported 但它不起作用,当您在Android Studio中打开AndroidManifest.xml时,您将看到一个名为Merged Manifest的选项卡。 If you click the tab, the error contents are displayed.如果单击选项卡,则会显示错误内容。

在此处输入图像描述

error message for example例如错误信息

Merging Errors: Error: android:exported needs to be explicitly specified for element <receiver#androidx.media.session.MediaButtonReceiver>. 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.

In my case, it was difficult because this error was displayed, but when I additionally inserted the code below in the AndroidManifest.xml file, the error disappeared.就我而言,这很困难,因为显示了此错误,但是当我在AndroidManifest.xml文件中另外插入以下代码时,错误消失了。

...
      <receiver android:name="androidx.media.session.MediaButtonReceiver" android:exported="true">
        <intent-filter>
          <action android:name="android.intent.action.MEDIA_BUTTON" />
        </intent-filter>
      </receiver>
...

https://developer.android.com/reference/androidx/media/session/MediaButtonReceiver https://developer.android.com/reference/androidx/media/session/MediaButtonReceiver

Hope this helps you!希望这对你有帮助!

暂无
暂无

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

相关问题 android:exported需要明确指定 - android:exported needs to be explicitly specified android:exported 需要明确指定<service> . 针对 Android 12 的应用程序</service> - android:exported needs to be explicitly specified for <service>. Apps targeting Android 12 android:exported 需要明确指定<activity></activity> - android:exported needs to be explicitly specified for <activity> android:exported 需要明确指定<activity></activity> - android:exported needs to be explicitly specified for <activity> Android:exported 需要明确指定<service> .针对 Android 12 及更高版本的应用程序</service> - Android:exported needs to be explicitly specified for <service>.Apps targeting Android 12 and higher 清单合并失败:需要明确指定 android:exported<service> . 在 Jetpack Compose 项目中 - Manifest merger failed : android:exported needs to be explicitly specified for <service>. In a Jetpack Compose Project 清单合并失败:需要为元素显式指定 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:exported 需要明确指定<activity> . 针对 Android 12 的应用程序?</activity> - android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12? 清单合并失败:需要明确指定 android:exported<activity> - Manifest merger failed : android:exported needs to be explicitly specified for <activity> AndroidManifest 错误:android:exported 需要明确指定<activity></activity> - AndroidManifest error: android:exported needs to be explicitly specified for <activity>
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM