Skip to content

Instantly share code, notes, and snippets.

@tasyjean
Forked from nisrulz/build.gradle
Created June 9, 2018 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tasyjean/5d92ef96c008c2865904b8e865047fa1 to your computer and use it in GitHub Desktop.
Save tasyjean/5d92ef96c008c2865904b8e865047fa1 to your computer and use it in GitHub Desktop.
Gradle : build.gradle file for a AAR Module Library Project
apply plugin: 'com.android.library'
android {
signingConfigs {
release {
try {
keyAlias KEYSTORE_ALIAS
keyPassword KEY_PASSWORD
storeFile file(KEYSTORE_FILEPATH)
storePassword KEYSTORE_PASSWORD
}
catch (ex) {
throw new InvalidUserDataException("You should define KEYSTORE_ALIAS, KEYSTORE_FILEPATH, KEYSTORE_PASSWORD and KEY_PASSWORD in gradle.properties.")
}
}
}
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
archivesBaseName = "Project Name"
version = android.defaultConfig.versionName
}
buildTypes {
debug {
minifyEnabled false
}
release {
signingConfig signingConfigs.release
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
libraryVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.aar')) {
def fileName = "${archivesBaseName}-${version}-${variant.buildType.name}.aar"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment