两个或多个Module相互依赖的情况下,AndroidStudio运行出现问题Error:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency...
假如有Module A和B,我们希望A依赖B,运行时候可能会出现该问题,其中B的build.gradle里apply plugin:
apply plugin: 'com.android.application'
也就是Gradle将B编译称为application,也就是apk,这便是问题的关键;
解决方法:将上面该句改为:
apply plugin: 'com.android.library'
此时,Gradle将编译称为一个Library,也就是库,运行之后,如果出现这个问题:Error:Library projects cannot set applicationId. applicationId is set to 'xx.xxx' in default config.,那是因为一个库不允许设置applicationId,将对应builde.gradle中的applicationId删除即可