(转)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(示例代码相关的知识,希望能为你提供帮助。
出现该问题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(示例代码】http://stackoverflow.com/questions/27536491/how-to-import-android-project-as-library-and-not-compile-it-as-apk-android-stud
推荐阅读
- 使用create-react-app时的something is already running on port 3000
- Android修改状态栏颜色全方位教程
- AndroidStudio 3.0升级之compileimplementation简要说明
- iPhone的顶级水印去除器应用程序下载推荐合集(哪个最好())
- Windows 10如何修复Critical_process_died BSOD错误(解决办法)
- 如何在Windows 10上修复Steam磁盘写入错误(解决办法)
- Linux su命令
- 如何解决“Windows已停止此设备,因为它报告了问题”代码43()
- ghost怎样用,本文教您运用Ghost的办法