Android Studio解决unspecified on project app resolves to an APK archive which is not supported
Posted brave-sailor
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android Studio解决unspecified on project app resolves to an APK archive which is not supported相关的知识,希望对你有一定的参考价值。
出现该问题unspecified on project app resolves to an APK archive which is not supported as a compilation dependency的情形可能是:创建了两个Module,其中一个Module依赖另一个Module而导致了出现该问题;
如果在android Studio中,有ModuleA和ModuleB,我们希望ModuleA依赖ModuleB,运行时候可能会出现该问题,查看被依赖的ModuleB的build.gradle,里面可以看到:
apply plugin: ‘com.android.application‘
这句话告诉了Gradle将ModuleB编译称为application,也就是apk,这就是问题的所在;
解决方法:将上面该句改为:
apply plugin: ‘com.android.library‘
此时,Gradle将编译称为一个Library,也就是库,运行之后,如果出现这个问题:Error:Library projects cannot set applicationId. applicationId is set to ‘package_name‘ in default config.,那是因为一个库不允许设置applicationId,需要将builde.gradle — android — defaultConfig中的applicationId删除;
如果说,我们ModuleB仍然需要生成apk,则我们需要将其中公共的代码放到一个Module,作为一个support的库;
以上是关于Android Studio解决unspecified on project app resolves to an APK archive which is not supported的主要内容,如果未能解决你的问题,请参考以下文章
(转)Android Studio解决unspecified on project app resolves to an APK archive which is not supported(示例代码
在 AndroidManifest 中:期待 android:screenOrientation="unspecified"
Android studio报错,Error:Gradle: A problem occurred configuring root project 'MyFuck'.
Android screenOrientation API 18 - “nosensor” vs “locked”,“unspecified” vs “user” vs “fullUser”