- 报错
Android 项目导入 framework.jar编译报错 com.android.tools.r8.internal.Ub: Absent Code attribute in method that is not native or abstract
- 解决
implementation files 修改为 compileOnly files
compile(implementation,api)
这种是我们最常用的方式,使用该方式依赖的库将会参与编译和打包。
implementation:该依赖方式所依赖的库不会传递,只会在当前module中生效。
api:该依赖方式会传递所依赖的库,当其他module依赖了该module时,可以使用该module下使用api依赖的库。
provided(compileOnly)
只在编译时有效,不会参与打包
可以在自己的moudle中使用该方式依赖一些比如com.android.support,gson这些使用者常用的库,避免冲突。
apk(runtimeOnly)
只在生成apk的时候参与打包,编译时不会参与,很少用。
testCompile(testImplementation)
testCompile 只在单元测试代码的编译以及最终打包测试apk时有效。
debugCompile(debugImplementation)
debugCompile 只在debug模式的编译和最终的debug apk打包时有效
releaseCompile(releaseImplementation)
Release compile 仅仅针对Release 模式的编译和最终的Release apk打包