-
-
Save dbachelder/9534270 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
import com.android.build.gradle.AppPlugin | |
import com.android.build.gradle.LibraryPlugin | |
subprojects { | |
// 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 | |
it.afterEvaluate { subProject -> | |
// is this a library or an app? | |
if(subProject.plugins.hasPlugin(AppPlugin.class) || subProject.plugins.hasPlugin(LibraryPlugin.class)) { | |
// variants are accessed in different ways for each.. | |
def variants = subProject.plugins.hasPlugin(AppPlugin.class) ? android.applicationVariants : android.libraryVariants | |
variants.all{ variant -> | |
variant.processManifest.doFirst { | |
File manifestFile = file("${buildDir}/exploded-bundles/ComGoogleMapsAndroidAndroidMapsUtils03.aar/AndroidManifest.xml") | |
if (manifestFile.exists()) { | |
println("Replacing minSdkVersion in Android Maps Utils in sub-project $subProject") | |
String content = manifestFile.getText('UTF-8') | |
content = content.replaceAll(/minSdkVersion="8"/, 'minSdkVersion=\"9\"') | |
manifestFile.write(content, 'UTF-8') | |
println(content) | |
} | |
} | |
} | |
} | |
} | |
} |
But your way seems fine too... probably less brittle.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ignaclogs sorry, i didn't see this earlier!
you just need some imports: