【发布时间】:2016-01-24 10:14:26
【问题描述】:
我已将一个模块导入到我的项目中。当我重建项目时,AS 给了我一个错误,提示警告:依赖项库:项目应用程序上的未指定解析为不支持作为编译依赖项的 APK 存档。 我搜索并更改了应用插件:'com.android.application' 到 apply plugin: 'com.android.library' 并且还从 defaultConfig 中删除了 ApplicationId。但是我遇到了同样的错误"Warning:Dependency Lib:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency." 有人可以帮我吗?
这是我的 gradle 代码:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 12
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile project(':DimenLib')
}
【问题讨论】:
-
你能发布你的 gradle 代码吗?
-
@David 这是模块或应用程序的 gradle 代码,还有你得到的错误“警告:依赖库:未指定”表明它找不到库,这就是为什么显示未指定
-
根据相同的@Amar 建议,如果您开发 app,您的 gradle 有
apply plugin: 'com.android.application'否则如果是module,您的 gradle 有apply plugin: 'com.android.library' -
检查this
标签: android android-studio gradle aar library-project