兩個或多個Module相互依賴的情況下,AndroidStudio運行出現(xiàn)問題Error:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency...
假如有Module A和B憔狞,我們希望A依賴B,運行時候可能會出現(xiàn)該問題福青,其中B的build.gradle里apply plugin:
apply plugin: 'com.android.application'
也就是Gradle將B編譯稱為application,也就是apk坯癣,這便是問題的關(guān)鍵芍秆;
解決方法:將上面該句改為:
apply plugin: 'com.android.library'
此時,Gradle將編譯稱為一個Library钱床,也就是庫荚斯,運行之后,如果出現(xiàn)這個問題:Error:Library projects cannot set applicationId. applicationId is set to 'xx.xxx' in default config.查牌,那是因為一個庫不允許設(shè)置applicationId事期,將對應(yīng)builde.gradle中的applicationId刪除即可