apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion android_build_tools
defaultConfig {
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
tasks.whenTaskAdded { task ->
if (task.name == "compileDebugJavaWithJavac") {
task << {
def file1 = new File('build/intermediates/classes/debug/cn/richinfo/plugin/stub/AbstractServiceStub.class');
def file2 = new File('build/intermediates/classes/debug/cn/richinfo/plugin/stub/AbstractServiceStub$1.class');
if (file1 != null && file1.exists()) {
file1.delete()
file2.delete()
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
provided fileTree(dir: 'lib', include: '*.jar')
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:${android_support_lib_version}"
}
task toAssets {
doLast {
copy {
delete 'richplugin.jar'
from('build/intermediates/bundles/debug/')
into('.')
include('classes.jar')
rename('classes.jar', 'richplugin.jar')
}
exec {
commandLine "/Users/blue/Library/Android/sdk/build-tools/23.0.2/dx", '--dex', '--output=richplugin_dex.jar', 'richplugin.jar'
}
copy {
delete '../example/src/main/assets/richplugin_dex.jar'
from('.')
into('../example/src/main/assets')
include('richplugin_dex.jar')
}
}
}
打jar包的脚本存放在build.gradle
最新推荐文章于 2021-06-30 21:14:16 发布