![](/img/trans.png)
[英]Error:Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'
[英]Error:Could not determine the dependencies of task ':app:preDebugBuild'
我更新到 Android Studio 3.0.1 并在我的控制台中出现此错误:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :libraries:Jumble:generateDebugSources, :libraries:Jumble:generateDebugAndroidTestSources, :libraries:Jumble:mockableAndroidJar]
Error:Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :libraries:Jumble.
Required by:
project :app
> Cannot choose between the following configurations of project :libraries:Jumble:
- debugRuntimeElements
- releaseRuntimeElements
All of them match the consumer attributes:
- Configuration 'debugRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' but no value provided.
- Found com.android.build.api.attributes.BuildTypeAttr 'debug' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but no value provided.
- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found compatible value 'java-runtime'.
- Configuration 'releaseRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' but no value provided.
- Found com.android.build.api.attributes.BuildTypeAttr 'release' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but no value provided.
- Found com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but wasn't required.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.api.attributes.Usage 'java-runtime' and found compatible value 'java-runtime'.
更新后出现这个问题的原因是什么?
固定问题! 我的应用程序在根文件夹中没有build.gradle
文件。 我添加了以下内容,问题已解决:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
如果您有任何模块库,它也应该具有在您的应用程序项目中提到的相同构建类型。 我也在库中添加了这个 buildTypes,因为与您的应用程序中提到的类型相同。
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug{}
uat{}
}
它对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.