【发布时间】:2021-09-25 19:33:30
【问题描述】:
当我尝试编译 APK 文件时,我收到下一个错误:
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 没有看到。我的价值清单:
<?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之外的任何解决方法?
【问题讨论】:
-
检查您的合并清单,例如通过 Android Studio 清单编辑器中的“合并清单”选项卡。也许您正在使用的第三方库正在贡献一个缺少此属性的组件。
-
@CommonsWare 我只使用 compose 和 androidx.lifecycle:lifecycle-viewmodel-ktx。但我会检查谢谢。
-
@CommonsWare 有没有办法在 Intellij Idea 中检查它?因为我无法在 AS 中构建项目(出现“未知错误”)
-
在 IDEA 的清单编辑器中似乎有一个“Merged Manifest”子选项卡(在 2021.2.2 版本上测试)。
-
@CommonsWare 我发现
androidx.test.core没有这样的价值,但我该怎么处理它?我没有将它添加到依赖项中
标签: android kotlin gradle android-gradle-plugin