Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/391.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 错误:无法确定任务';的依赖项:app:preDebugBuild&x27;_Java_Android Studio 3.0 - Fatal编程技术网

Java 错误:无法确定任务';的依赖项:app:preDebugBuild&x27;

Java 错误:无法确定任务';的依赖项:app:preDebugBuild&x27;,java,android-studio-3.0,Java,Android Studio 3.0,我更新到Android Studio 3.0.1,在我的控制台中出现以下错误: Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :libraries:Jumble:generateDebugSources, :libraries:Jumble:generateDebugAndroidTestSources, :li

我更新到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{}
    }

它对我有用。

对这个问题没有帮助。你介意指出你到底添加了什么吗?你解决了吗?@JohnSardinha,是的!