I'm trying to generate signed apk and I keep getting this error. I searched on Google for the error but haven't come up with anything solid. Any help would be great. Thank you.
Task :app:processReleaseManifest FAILED [com.facebook.android:audience-network-sdk:6.4.0] /Users/xxxx/.gradle/caches/transforms-2/files-2.1/1208b0b00589b6f8b9220695fa10ec7b/audience-network-sdk-6.4.0/AndroidManifest.xml:12:9-55 Error: Missing 'package' key attribute on element package at [com.facebook.android:audience-network-sdk:6.4.0] AndroidManifest.xml:12:9-55 [com.facebook.android:audience-network-sdk:6.4.0] /Users/xxxx/.gradle/caches/transforms-2/files-2.1/1208b0b00589b6f8b9220695fa10ec7b/audience-network-sdk-6.4.0/AndroidManifest.xml Error: Validation failed, exiting
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
Execution failed for task ':app:processReleaseManifest'.
> Manifest merger failed with multiple errors, see logs
It's probably because some changes the Android team has made on Gradle. Right now, if your Gradle version is lower than 4.1, you'll probably see one or a combination of these errors:
<queries>
found in <manifest>
To solve them, they suggest doing one of two things:
1. Upgrade your Gradle to 4.1 version or higher
Just update your build.gradle file by changing the version in the classpath.
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
...
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0' //change it here
}
}
2. Update your Gradle to a version compatible with your current version
If you don't want to update your Gradle to the latest version, you can stick with your current by changing it to a dot release equivalent to the version you are using without having to worry with compatibility issues.
Your current version | Dot release equivalent |
---|---|
4.1.* | No upgraded needed |
4.0.* | 4.0.1 |
3.6.* | 3.6.4 |
3.5.* | 3.5.4 |
3.4.* | 3.4.3 |
3.3.* | 3.3.3 |
So for instance, if you're running your app at 4.0.0 you just change it to 4.0.1 also in the build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
// classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
Google suggests using the second option if your app is depending on third party APIs or old Gradle versions.
We know that not everyone is ready to upgrade to the latest version, though, and you may be relying on old versions of Gradle or libraries that aren’t compatible with 4.1.
You can learn more about what's changed in their official post here.