|
@@ -1,14 +1,20 @@
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'com.android.application'
|
|
|
apply plugin: 'com.getkeepsafe.dexcount'
|
|
apply plugin: 'com.getkeepsafe.dexcount'
|
|
|
apply plugin: 'me.tatarka.retrolambda'
|
|
apply plugin: 'me.tatarka.retrolambda'
|
|
|
|
|
+//定义时间
|
|
|
|
|
+def releaseTime() {
|
|
|
|
|
+ return new Date().format("yyyyMMddHHmmss")
|
|
|
|
|
+}
|
|
|
|
|
+//设置发布的显示的版本号
|
|
|
|
|
+def getVersionName(){
|
|
|
|
|
+ return rootProject.ext.android.versionName
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
android {
|
|
android {
|
|
|
-
|
|
|
|
|
compileOptions {
|
|
compileOptions {
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
signingConfigs {
|
|
signingConfigs {
|
|
|
config {
|
|
config {
|
|
|
storeFile file('C:/sigin/applicationsignname[20150409]')
|
|
storeFile file('C:/sigin/applicationsignname[20150409]')
|
|
@@ -17,7 +23,6 @@ android {
|
|
|
keyPassword '13237658359'
|
|
keyPassword '13237658359'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
|
|
buildToolsVersion rootProject.ext.android.buildToolsVersion
|
|
buildToolsVersion rootProject.ext.android.buildToolsVersion
|
|
|
|
|
|
|
@@ -29,7 +34,6 @@ android {
|
|
|
versionName rootProject.ext.android.versionName
|
|
versionName rootProject.ext.android.versionName
|
|
|
multiDexEnabled true
|
|
multiDexEnabled true
|
|
|
signingConfig signingConfigs.config
|
|
signingConfig signingConfigs.config
|
|
|
-
|
|
|
|
|
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "umeng"]
|
|
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "umeng"]
|
|
|
ndk {
|
|
ndk {
|
|
|
abiFilters "armeabi", "armeabi-v7a", "x86", "mips","x86_64","mips64"
|
|
abiFilters "armeabi", "armeabi-v7a", "x86", "mips","x86_64","mips64"
|
|
@@ -38,11 +42,10 @@ android {
|
|
|
|
|
|
|
|
useLibrary 'org.apache.http.legacy'
|
|
useLibrary 'org.apache.http.legacy'
|
|
|
lintOptions {
|
|
lintOptions {
|
|
|
|
|
+ checkReleaseBuilds false
|
|
|
abortOnError false
|
|
abortOnError false
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
packagingOptions {
|
|
packagingOptions {
|
|
|
exclude 'META-INF/LICENSE.txt'
|
|
exclude 'META-INF/LICENSE.txt'
|
|
|
exclude 'META-INF/NOTICE.txt'
|
|
exclude 'META-INF/NOTICE.txt'
|
|
@@ -58,8 +61,9 @@ android {
|
|
|
signingConfig signingConfigs.config
|
|
signingConfig signingConfigs.config
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- productFlavors { // 友盟多渠道打包
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 友盟多渠道打包
|
|
|
|
|
+ productFlavors {
|
|
|
// wandoujia {}
|
|
// wandoujia {}
|
|
|
// _360 {}
|
|
// _360 {}
|
|
|
baidu {}
|
|
baidu {}
|
|
@@ -72,20 +76,28 @@ android {
|
|
|
flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
|
|
flavor -> flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
|
|
|
}
|
|
}
|
|
|
//给apk添加对应的版本号:这里暂时注释但保留
|
|
//给apk添加对应的版本号:这里暂时注释但保留
|
|
|
-// applicationVariants.all { variant ->
|
|
|
|
|
-// variant.outputs.each { output ->
|
|
|
|
|
-// def outputFile = output.outputFile
|
|
|
|
|
-// if (outputFile != null && outputFile.name.endsWith('.apk')) {
|
|
|
|
|
-// def fileName = outputFile.name.replace(".apk", "-${defaultConfig.versionName}.apk")
|
|
|
|
|
-// output.outputFile = new File(outputFile.parent, fileName)
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ //配置自定义打包名称
|
|
|
|
|
+ applicationVariants.all { variant ->
|
|
|
|
|
+ variant.outputs.each { output ->
|
|
|
|
|
+ def outputFile = output.outputFile
|
|
|
|
|
+ def fileName
|
|
|
|
|
+ if (outputFile != null && outputFile.name.endsWith('.apk')) {
|
|
|
|
|
+ if (variant.buildType.name.equals('release')) {
|
|
|
|
|
+ variant.mergedFlavor.versionName = getVersionName()+"."+releaseTime()
|
|
|
|
|
+ fileName = "UU互联_${variant.mergedFlavor.versionName}_release.apk"
|
|
|
|
|
+ } else if (variant.buildType.name.equals('debug')) {
|
|
|
|
|
+ variant.mergedFlavor.versionName = getVersionName()+"."+releaseTime()
|
|
|
|
|
+ fileName = "UU互联_${variant.mergedFlavor.versionName}_debug.apk"
|
|
|
|
|
+ }
|
|
|
|
|
+ output.outputFile = new File(outputFile.parent, fileName)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
dependencies {
|
|
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
|
|
- //依赖库
|
|
|
|
|
|
|
+
|
|
|
testCompile deps.junit
|
|
testCompile deps.junit
|
|
|
compile deps.appcompatV7
|
|
compile deps.appcompatV7
|
|
|
compile deps.cardviewV7
|
|
compile deps.cardviewV7
|