gpt4 book ai didi

android - Debug 间接依赖于 Android API 级别 X,但变体 'debug' 的 minSdkVersion 是 API 级别 Y

转载 作者:行者123 更新时间:2023-12-03 06:25:56 29 4
gpt4 key购买 nike

我有一个使用 Android Studio 创建的 Android 项目。我在项目中添加了一些第三方依赖项,但是当我尝试在 Android Studio 中编译时,我遇到了以下错误:

Error:Execution failed for task ':app:prepareDebugDependencies'.
> ERROR: Debug has an indirect dependency on Android API level 14, \
but minSdkVersion for variant 'debug' is API level 8

使用 ./gradlew 在命令行上编译工作正常。

这个错误是什么意思?

我如何解决它?

非常感谢。

更新:

我的顶级 build.gradle 文件:
[snowch@laptop MyApplication]$ cat build.gradle 
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven { url "http://maven.restlet.org" }
}
}

应用程序模块的 build.gradle:
[snowch@laptop MyApplication]$ cat app/build.gradle 
apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.example.snowch.myapplication"
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'net.christophersnow:sync-android-p2p:0.0.1-SNAPSHOT'

compile("org.restlet.jse:org.restlet:2.1-M7") {
exclude group: 'org.osgi', module: 'org.osgi.core'
}
compile("org.restlet.jse:org.restlet.ext.simple:2.1-M7")

}

最佳答案

设置minSdkVersion14app\build.gradle文件为我解决了这个问题。

感谢 murtaza-hussaingabriele-mariotti为灵感。

关于android - Debug 间接依赖于 Android API 级别 X,但变体 'debug' 的 minSdkVersion 是 API 级别 Y,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28249789/

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