问题描述
当我尝试编译 APK 文件时,出现下一个错误:dove\frontend\android\src\main\AndroidManifest.xml 错误:当相应组件定义了 Intent 过滤器时,针对 Android 12 及更高版本的应用需要为android:exported"指定显式值.
When I'm trying to compile an APK file I get the next error:dove\frontend\android\src\main\AndroidManifest.xml Error: 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.
我有这样的价值,但AGP没有看到.我的价值清单:
I have such value, but AGP does not see it. My manifest with value:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dove.android">
<application
android:name=".DoveApplication"
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="Dove"
android:supportsRtl="true"
android:theme="@style/Theme.Dove">
<activity
android:exported="true"
android:name=".AppActivity"
android:label="Dove"
android:theme="@style/Theme.Dove.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
AGP 版本:4.2.2除了降级 targetSdk
之外还有其他解决方法吗?
AGP version: 4.2.2Any workarounds except of downgrading targetSdk
?
推荐答案
您需要做的就是打开清单并选择合并清单";在底部面板中,查找添加没有此属性的活动的依赖项.就我而言,它是来自 compose 单元测试的 androidx.core.test
.
All you need to do is open the manifest and select "Merged Manifest" in the bottom panel and look for the dependency that adds the activity without this property.In my case, it was androidx.core.test
from compose unit tests.
这篇关于针对 Android 12 及更高版本的应用需要为“android:exported"指定一个明确的值,但我有这样的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!