Apps targeting Android 12 and higher are required to specify an explicit value for `android
时间: 2023-10-19 07:01:56 浏览: 118
Android10自动连接WiFi问题的解决
5星 · 资源好评率100%
:exported` attribute in the AndroidManifest.xml file for all components (activities, services, receivers, providers). This attribute indicates whether a component is accessible from other apps or not. It helps enhance the security of Android apps by explicitly defining the accessibility of each component.
Previously, if this attribute was not specified, the default behavior was that components were considered exported. However, starting from Android 12, specifying an explicit value for this attribute is mandatory for all components.
To specify the value for `android:exported`, you need to set it to either `true` or `false` depending on your app's requirements. If you want to allow other apps to access the component, set it to `true`. If you want to restrict access to only your app, set it to `false`.
Here is an example of how the `android:exported` attribute can be set for an activity in the AndroidManifest.xml file:
```xml
<activity android:name=".MainActivity"
...
android:exported="true">
...
</activity>
```
Make sure to review and update the `android:exported` attribute for all components in your AndroidManifest.xml file when targeting Android 12 and higher to comply with the new requirement.
阅读全文