萌萌の初音
萌萌の初音
发布于 2024-07-28 / 47 阅读
0

build.gradle引入包区别

implementation(compile)

该依赖方式所依赖的库不会传递,只会在当前module中生效。

api(compile)

该依赖方式会传递所依赖的库,当其他module依赖了该module时,可以使用该module下使用api依赖的库。

compileOnly(provided):

只在编译时有效,不会参与打包。

runtimeOnly(apk):

只在生成apk的时候参与打包,编译时不会参与。

testImplementation(testCompile):

只在单元测试代码的编译以及最终打包测试apk时有效。

debugImplementation(debugCompile):

只在debug模式的编译和最终的debug apk打包时有效。

releaseImplementation(releaseCompile):

仅仅针对Release 模式的编译和最终的Release apk打包。