出现该问题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,里面可以看到:

  1. apply plugin: 'com.android.application'

这句话告诉了Gradle将ModuleB编译称为application,也就是apk,这就是问题的所在;

解决方法:将上面该句改为:

  1. 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的库;

http://stackoverflow.com/questions/27536491/how-to-import-android-project-as-library-and-not-compile-it-as-apk-android-stud

(转)Android Studio解决unspecified on project app resolves to an APK archive which is not supported的更多相关文章

  1. 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 d ...

  2. 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 d ...

  3. Android Studio添加应用作为依赖时报错Error:Dependency MonthText:xlistview:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: 及其解决方案

    Error:Dependency MonthText:xlistview:unspecified on project app resolves to an APK archive which is ...

  4. 【已解决】Android Studio下,gradle project sync failed 错误

    原文:[已解决]Android Studio下,gradle project sync failed 错误 Android studio下突然报错 gradle project sync failed ...

  5. Android Studio中提示:Project SDK is not defined

    Android Studio中提示:Project SDK is not defined 2015 年 4 月 1 日 下午 9:04crifan已有2209人围观我来说几句 [背景] 之前用Andr ...

  6. Android Studio一直显示Building“project name”Gradle project info问题详解

    关注我,每天都有优质技术文章推送,工作,学习累了的时候放松一下自己. 本篇文章同步微信公众号  欢迎大家关注我的微信公众号:「醉翁猫咪」 Android Studio一直显示 Building&quo ...

  7. Android Studio新建一个HelloWorld 程序(App)

    Android Studio新建一个HelloWorld程序(App) 新建 或者直接启动程序(注:如果已有程序,此方法会直接打开最近一次关闭从程序) 更改App名 选择App运行平台 选择模板 更改 ...

  8. Android Studio 解决更新慢的问题

    Android Studio 解决更新慢的问题 最近在一些群里有伙伴们反应工具更新慢,由于国内网络对google限制的原因,android studio更新一直是个老大难的问题,为了,提高sdk下载的 ...

  9. Android Studio 解决 Gradle 依赖冲突的问题

    Android Studio 解决 Gradle 依赖冲突的问题 参考链接: Android Studio(Gradle)解决库依赖冲突问题:http://www.mobibrw.com/2016/3 ...

随机推荐

  1. element table 通过selection-change选中的索引删除

    <el-table :row-class-name="tableRowClassName" @selection-change="handleSelectionCh ...

  2. 防止NSTimer和调用对象之间的循环引用

    防止NSTimer和调用对象之间的循环引用 @interface NSTimer (EOCBlocksSupport) + (NSTimer *)eoc_scheduledTimerWithTimeI ...

  3. GridManager 隐藏列

    GridManager 表格管理组件, 对列的隐藏与显示的操作有两种方式. 初始化时指定列为隐藏或显示状态.方式如下: <table></table> var table = ...

  4. SVG开发包, 20 个有用的 SVG 工具,提供更好的图像处理

    20 个有用的 SVG 工具,提供更好的图像处理 SVG 现正在 Web 设计领域变得越发流行, 你可以使用 Illustrator 或者 Inkscape 来创建 SVG 图像. 但当进行 Web ...

  5. spring data jpa 多对多查询

    package com.ytkj.dao; import com.ytkj.entity.Customer; import com.ytkj.entity.Role; import org.sprin ...

  6. SAP内表查询速度优化实例-OPEN SQL

    一.FOR ALL ENTRIES IN 案例 今天碰到工单报工统计分析表查询速度特别慢 经查看源代码: SELECT afpo~dwerk afko~aufnr afpo~matnr AS plnb ...

  7. div中的div上下居中

    方法1: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 .parent {           width:800px;           height:500px;       ...

  8. UVALive 4728 Squares(旋转卡壳)

    Squares The famous Korean IT company  plans to make a digital map of the Earth with help of wireless ...

  9. 52.Product of Array Except Self(除过自身的数组乘积)

    Level:   Medium 题目描述: Given an array nums of n integers where n > 1, return an array output such ...

  10. brew install ''package卡在Updating Homebrew

    关闭自动更新: export HOMEBREW_NO_AUTO_UPDATE=true