Avatar ·

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

大家好!我最近在Kotlin项目中将targetSdk更新到31(Android 12),现在构建时出现错误: ``` 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. ``` 这是我的AndroidManifest.xml: ```xml ``` 我知道需要添加`android:exported`,但不太清楚该设置什么值。对于MainActivity,我设置为`true`,因为它是应用的入口点。对于SecondActivity,我设置为`false`,因为它只从我的应用内部启动。但这样对吗?