Android Studio 3.0 - 无法找到方法“com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List" [英] Android Studio 3.0 - Unable to find method 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List'

查看:31
本文介绍了Android Studio 3.0 - 无法找到方法“com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 Android Studio 3.0 Canary 1 启动新的 Kotlin 项目时显示此错误.完整跟踪:

Trying to start a new Kotlin project with Android Studio 3.0 Canary 1 displays this error. Full trace:

错误:无法找到方法'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'.此意外错误的可能原因包括:

  • Gradle 的依赖缓存可能已损坏(这有时发生在网络连接超时.)重新下载依赖项并同步项目(需要网络)
  • Gradle 的状态构建进程(守护进程)可能已损坏.停止所有 Gradle 守护进程可能解决这个问题.停止 Gradle 构建进程(需要重新启动)
  • 您的项目可能正在使用与其他插件不兼容的第三方插件项目或 Gradle 版本要求
  • Error:Unable to find method 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'. 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.

    我已经尝试了前两个选项,第三方插件保持默认.

    I've tried the first two options and the third-party plugins are left as default.

    gradle-wrapper.properties

    #Thu May 18 08:36:52 BST 2017
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
    

    build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    
    buildscript {
        ext.kotlin_version = '1.1.2-3'
        repositories {
            maven { url 'https://maven.google.com' }
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            jcenter()
            maven { url 'https://maven.google.com' }
            mavenCentral()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    我自己没有接触过这些值中的任何一个,它们保留为默认值.创建一个非 Kotlin 的新项目没有这个问题.

    I haven't touched any of these values myself, they're left as default. Creating a non-Kotlin new project does not have this problem.

    推荐答案

    In my build.gradle 正在改变

    In my build.gradle changing

    ext.kotlin_version = '1.1.2-3'

    ext.kotlin_version = '1.1.2-4'

    解决了这个问题.

    您可以在此处找到最新版本.

    You can find the most recent version here.

    这篇关于Android Studio 3.0 - 无法找到方法“com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆