Created
December 17, 2015 16:36
-
-
Save zjbpku/05bcfd53a3f6718c4c80 to your computer and use it in GitHub Desktop.
build.gradle configuration
This file contains 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.google.gson.Gson | |
apply plugin: 'com.android.application' | |
apply plugin: 'android-apt' | |
def verCode = 5 | |
def verName = "2.0" | |
def getBuildTime() { | |
return System.currentTimeMillis(); | |
} | |
class SignInfo { | |
public String storeFile; | |
public String storePassword; | |
public String keyAlias; | |
public String keyPassword; | |
} | |
ext.signinfo = null; | |
def SignInfo parseSignInfo() { | |
if (signinfo == null) { | |
String str = GFileUtils.readFile(file("sign.config")); | |
signinfo = new Gson().fromJson(str, SignInfo.class); | |
} | |
return signinfo; | |
} | |
def getMyStoreFile() { | |
return parseSignInfo().storeFile; | |
} | |
def getMyStorePassword() { | |
return parseSignInfo().storePassword; | |
} | |
def getMyKeyAlias() { | |
return parseSignInfo().keyAlias; | |
} | |
def getMyKeyPassword() { | |
return parseSignInfo().keyPassword; | |
} | |
android { | |
compileSdkVersion 23 | |
buildToolsVersion "23.0.2" | |
defaultConfig { | |
applicationId "com.bin.lop" | |
minSdkVersion 21 | |
targetSdkVersion 22 | |
versionCode verCode | |
versionName verName | |
buildConfigField "int", "VerCode", "$verCode" | |
buildConfigField "String", "VerName", "\"$verName\"" | |
buildConfigField "String", "BuildTime", "\"${getBuildTime()}\"" | |
} | |
signingConfigs { | |
release { | |
storeFile file(getMyStoreFile()) | |
storePassword getMyStorePassword() | |
keyAlias getMyKeyAlias() | |
keyPassword getMyKeyPassword() | |
} | |
debug { | |
storeFile file(getMyStoreFile()) | |
storePassword getMyStorePassword() | |
keyAlias getMyKeyAlias() | |
keyPassword getMyKeyPassword() | |
} | |
} | |
buildTypes { | |
debug { | |
applicationIdSuffix '.debug' | |
minifyEnabled false | |
signingConfig signingConfigs.debug | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
} | |
release { | |
minifyEnabled true | |
signingConfig signingConfigs.release | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
} | |
} | |
productFlavors { | |
Google {} | |
// Baidu {} | |
// Jiu1 {} | |
// Qiku {} | |
// Wandoujia {} | |
// Xiaomi {} | |
// Tencent {} | |
// YAppChina {} | |
// MeiZu {} | |
// OnePlus {} | |
} | |
productFlavors.all { flavor -> | |
flavor.manifestPlaceholders = [CHANNEL: name] | |
} | |
lintOptions { | |
checkReleaseBuilds false | |
// Or, if you prefer, you can continue to check for errors in release builds, | |
// but continue the build even when errors are found: | |
abortOnError false | |
} | |
dexOptions { | |
incremental false | |
} | |
compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_7 | |
targetCompatibility JavaVersion.VERSION_1_7 | |
} | |
useLibrary 'org.apache.http.legacy' | |
} | |
apt { | |
arguments { | |
androidManifestFile variant.outputs[0].processResources.manifestFile | |
// if you have multiple outputs (when using splits), you may want to have other index than 0 | |
// resourcePackageName 'jabin.notifcationmanager' | |
// If you're using Android NBS flavors you should use the following line instead of hard-coded packageName | |
resourcePackageName android.defaultConfig.applicationId | |
// You can set optional annotation processing options here, like these commented options: | |
// logLevel 'INFO' | |
// logFile '/var/log/aa.log'` | |
} | |
} | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
// replace with the current version of the Android plugin | |
classpath 'com.android.tools.build:gradle:1.3.0' | |
// replace with the current version of the android-apt plugin | |
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' | |
classpath 'com.google.code.gson:gson:2.4' | |
} | |
} | |
def AAVersion = "3.3.2" | |
def version = "23.1.1" | |
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
compile "com.android.support:appcompat-v7:$version" | |
compile "com.android.support:cardview-v7:$version" | |
compile "com.android.support:recyclerview-v7:$version" | |
compile 'com.squareup:otto:1.3.7' | |
compile 'com.squareup.okhttp:okhttp:2.3.0' | |
apt "org.androidannotations:androidannotations:$AAVersion" | |
compile "org.androidannotations:androidannotations-api:$AAVersion" | |
compile 'com.google.dagger:dagger:2.0.1' | |
compile 'com.google.dagger:dagger-compiler:2.0.1' | |
compile 'com.umeng.analytics:analytics:latest.integration' | |
provided 'org.glassfish:javax.annotation:10.0-b28' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment