Reputation: 19848
I'm trying to get around an annoying issue with Gradle that does not allow libraries to have different min/target sdk's. The solution was to add the following to build.gradle.
android.applicationVariants.all{ variant ->
// This is an annoying hack to get around the fact that the Gradle plugin does not support
// having libraries with different minSdkVersions. Play Services has a min version of 9 (Gingerbread)
// but Android Maps Utils supports 8 (Froyo) still
variant.processManifest.doFirst {
File manifestFile = file("${buildDir}/exploded-bundles/ComGoogleMapsAndroidAndroidMapsUtils03.aar/AndroidManifest.xml")
if (manifestFile.exists()) {
println("Replacing minSdkVersion in Android Maps Utils")
String content = manifestFile.getText('UTF-8')
content = content.replaceAll(/minSdkVersion="8"/, 'minSdkVersion=\"9\"')
manifestFile.write(content, 'UTF-8')
println(content)
}
}
}
However when i do that, I get an error that applicationVariants cannot be resolved. How do I fix this?
Upvotes: 5
Views: 2365
Reputation: 19848
Aparrently, this is an Android Studio bug and is telling me there are errors where there's none. Building and ignoring works fine.
Upvotes: 1