java - Android Studio 3.1.3中的构建gradle失败

标签 java android gradle

我遇到这个错误构建gradle:

org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.



build.grandle :
apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "com.google.android.gms.samples.vision.face.facetracker"
        minSdkVersion 19
        targetSdkVersion 24
        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:support-v4:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.google.android.gms:play-services-vision:9.4.0+'
    compile 'org.apache.commons:commons-math3:3.6.1'
    compile 'com.edwardraff:JSAT:0.0.9'
}

grandle-wrapper.properties :
#Sun Sep 02 12:44:30 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

我该如何解决?

最佳答案

我不知道这是否行得通,而是用“实现”代替“编译”。
看看这个:What's the difference between implementation and compile in Gradle?

关于java - Android Studio 3.1.3中的构建gradle失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52136358/

相关文章:

java - 使用 Maven 运行代码(测试)时如何启用断言?

Java HashMap 内容

java - Android - 从 HashMap 中获取值

java - 如何修复 "com.google.cloud.tools.appengine.AppEngineException: java.nio.file.NoSuchFileException: ...\exploded-{project}\WEB-INF\appengine-web.xml"

android - 在单独的模块中进行 Espresso 测试

java - 使用 PowerMock 和 Mockito 模拟静态方法

java - fatal error :1:1: Content is not allowed in prolog

java - 安卓蓝牙连接到配对设备

android - 使用 Flutter 从方法中获取一些变量值

Android Twitter Fabric SDK 与 Google GSON 冲突