React本机应用程序。尽管已经在清单中输入了android:exported="真">我在构建阶段仍然有这个问题。似乎有些安装的插件没有插入。
我在一些帖子中读到,作为降级到android SDK版本30的临时解决方案,但我不能,因为该版本不允许我编译。
- React Native 0.68
- Android SDK版本33
- Android Gradle插件7.3.0版本
来自合并清单
错误:android:exported需要为元素<activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity>。当相应组件定义了意向过滤器时,针对Android 12及更高版本的应用程序需要为android:exported
指定明确的值。看见https://developer.android.com/guide/topics/manifest/activity-element#exported详细信息。mobile_app.app调试清单,第26行错误:android:exported需要为元素<activity#androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity>。当相应组件定义了意向过滤器时,针对Android 12及更高版本的应用程序需要为android:exported
指定明确的值。看见https://developer.android.com/guide/topics/manifest/activity-element#exported详细信息。mobile_app.app调试清单,第33行
根据Aleja Duque Torres的回复,这里有一个临时解决方案,将以下代码段添加到您的AndroidManifest.xml 中
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="...your package name"
xmlns:tools="http://schemas.android.com/tools"> <!-- ADD THIS LINE -->
<!-- Other Content -->
<application
.../>
<!-- ADD STARTS HERE -->
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="false"
tools:replace="android:exported"/>
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="false"
tools:replace="android:exported"/>
<activity
android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="false"
tools:replace="android:exported"/>
<!-- ADD ENDS HERE -->
</application>
</manifest>
然后清理生成文件夹并再次运行该项目。希望这能有所帮助!
附言:我的猜测是,这个问题是由于一些依赖程序包搞砸了。如果其他人有任何见解,请随时透露!
解决方案:
- 在Git bash中运行:*/gradlew assemblyDebug--stacktrace--info|tee-my-logs.txt
- 搜索";InstrumentationActivityInvoker">
- 打开文件并添加android:exported="真";关于活动
同样的问题,但我不知道原因。当我更新macos时会发生这种情况,你有任何信息吗?