Gradle 3.0.0-alpha1与kotlin-android插件1.1.2-3不兼容? [英] Gradle 3.0.0-alpha1 isn't compatible with kotlin-android plugin 1.1.2-3?

查看:305
本文介绍了Gradle 3.0.0-alpha1与kotlin-android插件1.1.2-3不兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装Android Studio 3.0 Canary 1并使用kotlin创建新项目。
并得到这个错误:

I Install Android Studio 3.0 Canary 1 and create new project with kotlin. And get this error:


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

  • Gradle的
    依赖关系缓存可能已损坏(有时发生在网络
    连接超时之后。)重新下载依赖关系
    和同步项目(需要网络)
  • Gradle
    构建过程(守护进程)的状态可能已损坏。停止所有的Gradle守护进程可能
    解决了这个问题。停止Gradle构建
    进程(需要重新启动)
  • 您的项目可能使用
    第三方插件,该插件与
    中的其他插件不兼容
    项目请求的Gradle版本。

如果我从build.gradle中删除了kotlin-android插件,它就会成功构建。

If i remove kotlin-android plugin from build.gradle it's successfully building.

gradle:

Build gradle:

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
}

app\build.gradle

app\build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.dmytrobazunov.databasetest"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    compile 'com.android.support:appcompat-v7:25.3.1'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
}

有人知道如何解决这个问题?

Does someone knowes how to fix this issue?

推荐答案

您需要将Kotlin插件版本更改为 1.1。 2-4

You need to change the Kotlin plugin version to 1.1.2-4.

这篇关于Gradle 3.0.0-alpha1与kotlin-android插件1.1.2-3不兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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