一、新建项目跟library
二、在library中写好封装的方法
三、在library的build.gradle文件中添加以下代码
task makeJar(type: proguard.gradle.ProGuardTask, dependsOn: "build") {
// 未混淆的jar路径
injars 'build/intermediates/bundles/release/classes.jar'
// 混淆后的jar输出路径
outjars 'build/outputs/cocolove2-banner-1.1.0.jar'
// 混淆协议
configuration 'proguard-rules.pro'
}
makeJar.dependsOn(build)
四、在library的proguard-rules.pro文件中代码修改成以下代码
# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
#
# Starting with version 2.2 of the Android plugin for Gradle, these files are no longer used. Newer
# versions are distributed with the plugin and unpacked at build time. Files in this directory are
# no longer maintained.
#表示混淆时不使用大小写混合类名
-dontusemixedcasecl