Files
assistant-android/app/build.gradle
2016-09-13 07:23:02 +08:00

117 lines
3.1 KiB
Groovy

apply plugin: 'com.android.application'
task('processWithJavassist') << {
String classPath = file('build/intermediates/classes/debug')//项目编译class所在目录
dodola.patch.PatchClass.process(classPath, project(':hackdex').buildDir
.absolutePath + '/intermediates/classes/debug')//第二个参数是hackdex的class所在目录
}
/**
* 导出jar包
*/
task buildJar(dependsOn: ['compileReleaseJavaWithJavac'], type: Jar) {
baseName = "news"
//后缀名
extension = "jar"
//最终的 Jar 包名,如果没设置,默认为 [baseName]-[appendix]-[version]-[classifier].[extension]
archiveName = "news.jar";
//需打包的资源所在的路径集
def srcClassDir = [project.buildDir.absolutePath + "/intermediates/classes/debug"];
from srcClassDir
//去除路径集下部分的资源
exclude "com/gh/gamecenter/BuildConfig.class"
exclude "com/gh/gamecenter/R.class"
exclude "com/gh/gamecenter/BuildConfig/\$*.class"
exclude "com/gh/gamecenter/R/\$*.class"
//只导入资源路径集下的部分资源
include "com/gh/gamecenter/NewsActivity.class"
include "com/gh/gamecenter/NewsActivity\$*.class"
//注: exclude include 支持可变长参数
}
android {
compileSdkVersion 21
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.gh.gamecenter"
minSdkVersion 14
targetSdkVersion 21
versionCode 15
versionName "2.0"
// 默认的渠道
// manifestPlaceholders = [CHANNEL_VALUE: "GH_TEST"]
}
/**
* 签名设置
*/
signingConfigs {
release {
storeFile file("gh.keystore")
keyAlias "gh.keystore"
keyPassword "20150318"
storePassword "20150318"
}
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
// applicationVariants.all { variant ->
// variant.dex.dependsOn << processWithJavassist //在执行dx命令之前将代码打入到class中
// }
/**
* 多渠道打包
*/
productFlavors {
GH_100 {}
GH_101 {}
GH_102 {}
GH_103 {}
GH_104 {}
GH_106 {}
GH_109 {}
GH_110 {}
GH_113 {}
GH_114 {}
GH_115 {}
GH_116 {}
GH_118 {}
GH_119 {}
GH_120 {}
GH_121 {}
GH_123 {}
GH_127 {}
GH_200 {}
GH_201 {}
GH_202 {}
GH_203 {}
GH_307 {}
}
productFlavors.all { flavor ->
flavor.manifestPlaceholders = [CHANNEL_VALUE: name]//命令 gradlew assembleRelease
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.16'
compile 'com.android.support:cardview-v7:21.0.0'
}