//打jar包的时候因为代码的不规范,需要避免
android{
.....
lintOptions {
abortOnError false
}
}
//打包jar的代码,构建通过后在右侧gradle中找到需要打包的lib,
//找到library/Tasks/other/makeJar,双击makeJar生成jar包
def SDK_BASENAME ="ShareMoreImage";
def SDK_VERSION ="_V1.0.0";
def sdkDestinationPath ="build";
def zipFile = file('build/intermediates/bundles/default/classes.jar')
task deleteBuild(type: Delete) {
delete sdkDestinationPath + SDK_BASENAME + SDK_VERSION +".jar"
}
task makeJar(type: Jar) {
from zipTree(zipFile)
from fileTree(dir:'src/main',includes: ['assets/**'])//将assets目录打入jar包
baseName= SDK_BASENAME + SDK_VERSION
destinationDir= file(sdkDestinationPath)
}
makeJar.dependsOn(deleteBuild, build)