gradle template
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.google.gms.google-services'
def cmd = 'git rev-list HEAD --first-parent --count'
def gitVersion = cmd.execute().text.trim().toInteger()
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
useLibrary 'org.apache.http.legacy'
signingConfigs {
devconfig {
keyAlias 'tanggod-alias'
keyPassword project.SIGNATURE_PASSWORD
//storeFile file('/Users/tanggod/android/signature/tanggod.keystore')
storeFile file('tanggod.keystore')
storePassword project.SIGNATURE_PASSWORD
}
releaseconfig {
// google play
keyAlias 'tanggod-alias'
keyPassword project.SIGNATURE_PASSWORD
//storeFile file('/Users/tanggod/android/signature/tanggod.keystore')
storeFile file('tanggod.keystore')
storePassword project.SIGNATURE_PASSWORD
}
}
defaultConfig {
applicationId "com.tanggod.sthlmsubway"
minSdkVersion 15
targetSdkVersion 25
//versionCode Integer.parseInt(project.VERSION_CODE)
versionCode gitVersion
versionName project.VERSION_NAME
multiDexEnabled true
}
buildTypes {
/**
* environments:
* public static final int DEV = 0;
* public static final int STAGE = 1;
* public static final int ADHOC = 2;
* public static final int RES = 3;
*
*/
debug {
// LOG_DEBUG 显示Log
buildConfigField "boolean", "LOG_DEBUG", "true"
//buildConfigField "String", "ENV", "\"dev\""
buildConfigField "int", "ENV", "0"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseconfig
debuggable true
jniDebuggable true
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
// 输出apk名称为 odin_v1.0.1(1)_20150324_debug
//def fileName = "odin_v${defaultConfig.versionName}_${releaseTime()}_${variant.productFlavors[0].name}.apk"
def fileName = "stockholm_rail_v${defaultConfig.versionName}.${defaultConfig.versionCode}_${releaseTime()}_${variant.buildType.name}.apk"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
}
/**
* environments:
* public static final int DEV = 0;
* public static final int STAGE = 1;
* public static final int ADHOC = 2;
* public static final int PRO = 3;
*
*/
release.initWith(buildTypes.debug)
release {
// LOG_DEBUG 不显示Log
buildConfigField "boolean", "LOG_DEBUG", "false"
//buildConfigField "String", "ENV", "\"product\""
buildConfigField "int", "ENV", "3"
signingConfig signingConfigs.releaseconfig
minifyEnabled true
debuggable false
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/rxjava.properties'
}
}
def releaseTime() {
return new Date().format("yyyyMMdd", TimeZone.getTimeZone("UTC"))
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.google.code.gson:gson:2.7'
compile 'com.android.support:support-annotations:25.1.1'
compile 'com.github.johnpersano:supertoasts:1.3.4@aar'
compile 'com.github.clans:fab:1.5.3'
compile 'com.android.support:design:25.1.1'
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}
compile 'com.jakewharton:butterknife:8.4.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.github.john990:WaveView:v0.9'
compile 'com.timqi.sectorprogressview:library:2.0.0'
compile 'me.itangqi.waveloadingview:library:0.3.2'
compile ('io.branch.sdk.android:library:2.+') {
exclude module: 'answers-shim'
}
// Google play services
compile 'com.google.android.gms:play-services-appinvite:10.0.1'
compile 'com.google.android.gms:play-services-analytics:10.0.1'
// for RxJava + Retrofit
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
compile 'com.android.support:multidex:1.0.1'
}