Created
March 13, 2014 17:59
-
-
Save goldierox/9533466 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} | |
} |
This version will account for multiple child projects of mixed type java/android/android-library
https://gist.github.com/dbachelder/9534270
Thanks a ton for the kickstart on this.
I have some truble with this, see googlemaps/android-maps-utils#60 (comment)
my path was:
File manifestFile = file("${buildDir}/exploded-aar/com.google.maps.android/android-maps-utils/0.3/AndroidManifest.xml")
This is my Fix:
just put it in the release type
android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.processManifest.doFirst {
File manifestFile = file("${buildDir}/intermediates/exploded-aar/com.ramotion.foldingcell/folding-cell/1.0.0/AndroidManifest.xml")
if (manifestFile.exists()) {
String content = manifestFile.getText('UTF-8')
content = content.replaceAll(/android:maxSdkVersion="17"/, '')
manifestFile.write(content, 'UTF-8')
}
}
}
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is perfect. Thanks!