E:\JIULANG\WordsFairy\App\app\build\intermediates\tmp\manifest\androidTest\debug\tempFile1ProcessTestManifest11394250735464286492.xml:27:9-33:20 Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity>. 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. E:\JIULANG\WordsFairy\App\app\build\intermediates\tmp\manifest\androidTest\debug\tempFile1ProcessTestManifest11394250735464286492.xml:34:9-40:20 Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity>. 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. E:\JIULANG\WordsFairy\App\app\build\intermediates\tmp\manifest\androidTest\debug\tempFile1ProcessTestManifest11394250735464286492.xml:41:9-47:20 Error: android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity>. 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.
时间: 2023-12-05 14:03:41 浏览: 150
Android Studio Bumblebee Beta 4(android-studio-2021.1.1.17)
这个错误是由于你的AndroidManifest.xml文件中的一些测试活动(InstrumentationActivityInvoker)缺少了`android:exported`属性的显式定义,而在目标为Android 12及更高版本的应用程序中,当组件具有定义的意图过滤器时,需要为`android:exported`属性指定显式值。你可以按照以下步骤进行修复:
1. 打开`app/src/androidTest/AndroidManifest.xml`文件。
2. 找到以下三个元素:
```xml
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity" />
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity" />
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity" />
```
3. 对于每个元素,添加`android:exported`属性并设置一个显式值(`true`或`false`),如下所示:
```xml
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="false" />
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="false" />
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="false" />
```
4. 保存文件并重新运行测试。
这样就可以解决`android:exported`未显式定义的错误。希望对你有帮助!如果还有其他问题,请随时提问。
阅读全文