需求:动态加载apk插件化开发时,插件工程中依赖的dl-libs.jar包,只想它参与编译,而不用打包到apk中
build.gradle依赖
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.code.gson:gson:2.8.0'
provided files('libs/dl-lib.jar')
}
解决步骤:
1:provided 表示对应的jar包只编译,不打包
provided files('libs/dl-lib.jar')
2:注释掉第一行compile fileTree(dir: 'libs', include: ['*.jar']),不然还是会打包到apk中
----------------------------------例子 -------------------------------------: