gpt4 book ai didi

Android Studio 库项目错误

转载 作者:IT老高 更新时间:2023-10-28 23:19:02 25 4
gpt4 key购买 nike

我已将一个模块导入到我的项目中。当我重建项目时,AS 给了我一个错误,提示警告:依赖项库:项目应用程序上的未指定解析为不支持作为编译依赖项的 APK 存档。 我搜索并将 apply plugin: 'com.android.application' 更改为 apply plugin: 'com.android.library' 并删除了 ApplicationId从默认配置。然而我得到了同样的错误“警告:依赖库:项目应用程序上的未指定解析为不支持作为编译依赖项的APK存档。”任何人都可以帮助我吗?

这是我的 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')
}

最佳答案

"Warning:Dependency Lib:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency."

当您尝试添加一个 APK 依赖项时会发生这种情况。

使用:

apply plugin: 'com.android.application'

告诉 Gradle 将其构建为应用程序,生成 APK

使用:

apply plugin: 'com.android.library'

它将构建为一个库,生成一个 AAR

在你的情况下,你似乎在错误的地方更改插件。
这似乎是你的主要模块

apply plugin: 'com.android.library'

dependencies {
compile project(':DimenLib')
}

apply plugin: 'com.android.library' 移动到您的 DimenLib 中。

关于Android Studio 库项目错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33326678/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com