Avatar ·

Android 12及以上版本的Activity的android:exported错误:如何修复?

你好!我是一名Kotlin初学者开发者,最近在构建Android 12(API 31)项目时遇到了问题。将targetSdkVersion更新到31后,Gradle报错: ``` android:exported needs to be explicitly specified for . 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. ``` 我的manifest中声明了几个Activity,例如: ```xml ``` 我知道需要添加`android:exported`,但不知道应该设置什么值。对于MainActivity——是`true`还是`false`?对于SecondActivity呢?如果我只是在所有地方添加`false`,会发生什么?应用会停止