Android Studio错误清单合并失败:导出的面向Android 12的应用已存在

7hiiyaii  于 2022-11-16  发布在  Android
关注(0)|答案(1)|浏览(163)

我不擅长英语,所以我用翻译。对不起。
我正在做一个在移动的上控制无人机的项目,我打算找到一个叫dronekit的模块并使用它,但当我应用它时,出现了同样的错误。
Manifest merger failed : android:exported needs to be explicitly specified for <service>. Apps targeting Android 12 and higher are required to specify an explicit value for安卓系统:已导出when the corresponding component has an intent filter defined
我清单:

<activity
        android:name=".MainActivity"
        android:exported="true"
        android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

我的建筑。gradle(:应用程序):

android {
...
compileSdk 31
defaultConfig {
    ...
    minSdk 23
    targetSdk 31
    ...
}
dependencies {
...
implementation files('../libs/dronekit-android.3.0.2.aar')
}

正如你所看到的,android:exported已经在里面了。但是在“合并清单”中有一个错误。请帮助我。

cbwuti44

cbwuti441#

当你用WinRAR打开Android库文件(dronekit.aar)时,你会看到一个AndroidManifest.xml文件,用记事本或任何文本编辑器打开它,并添加一个函数

android:exported="true"

然后在android studio中再次导出它,并在build.gradle中添加依赖关系。它将工作。

相关问题