Android Studio中有六種依賴(Compile替梨,Provided,APK装黑,Test compile副瀑,Debug compile,Release compile)
在Android Studio中恋谭,開發(fā)會常用的6中依賴方法糠睡。
Compile
compile是對所有的build type以及favlors都會參與編譯并且打包到最終的apk文件中。
Provided
Provided是對所有的build type以及favlors只在編譯時使用疚颊,類似eclipse中的external-libs,只參與編譯狈孔,不打包到最終apk。
APK
只會打包到apk文件中材义,而不參與編譯均抽,所以不能再代碼中直接調(diào)用jar中的類或方法,否則在編譯時會報錯
Test compile
Test compile 僅僅是針對單元測試代碼的編譯編譯以及最終打包測試apk時有效其掂,而對正常的debug或者release apk包不起作用油挥。
Debug compile
Debug compile 僅僅針對debug模式的編譯和最終的debug apk打包。
Release compile
Release compile 僅僅針對Release 模式的編譯和最終的Release apk打包。