Skip to content

Instantly share code, notes, and snippets.

@Sefford
Created July 25, 2014 14:06
Show Gist options
  • Save Sefford/0f360cc38b3898335710 to your computer and use it in GitHub Desktop.
Save Sefford/0f360cc38b3898335710 to your computer and use it in GitHub Desktop.
This method will switch minSDKVersion of RecyclerLibrary on compile time for version 13
applicationVariants.all{ variant ->
// This is a terrible hacky way of compile-time changing all the libraries
// minSDKs to SDK 13. This script has to be mantained everytime you update
// any of these libraries or the plugin updates.
variant.processManifest.doFirst {
File manifestFile = file("${buildDir}/intermediates/exploded-aar/com.android.support/recyclerview-v7/21.0.0-rc1/AndroidManifest.xml")
if (manifestFile.exists()) {
println("Replacing minSdkVersion of RecyclerView-V7 library")
String content = manifestFile.getText('UTF-8')
content = content.replaceAll(/minSdkVersion="L"/, 'minSdkVersion=\"13\"')
manifestFile.write(content, 'UTF-8')
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment