Android开发之Android Studio第三方库的六种依赖讲解说明

在Android Studio中有六种依赖

Compile,Provided,APK,Test compile,Debug compile,Release compile

1.Compile 是对所有的build type以及favlors都会参与编译并且打包到最终的apk文件中。

2.Provided 是对所有的build type以及favlors只在编译时使用,类似eclipse中的external-libs,只参与编译,不打包到最终apk。

3.APK 只会打包到apk文件中,而不参与编译,所以不能再代码中直接调用jar中的类或方法,否则在编译时会报错

4.Test compile Test compile 仅仅是针对单元测试代码的编译编译以及最终打包测试apk时有效,而对正常的debug或者release apk包不起作用。

5.Debug compile Debug compile 仅仅针对debug模式的编译和最终的debug apk打包。

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

猜你喜欢

转载自blog.csdn.net/xiayiye5/article/details/81667060