android - Gradle kotlin 不支持的方法 Dependencies.getAtoms()

标签 android gradle kotlin android-studio-3.0

刚刚使用 kotlin 使用 Studio 3.0 Canary 3 启动了一个新的 Android 项目,并试图让它进行 gradle 项目同步。目前失败了

Error:Unsupported method: Dependencies.getAtoms().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.

有谁知道这意味着什么以及如何解决它?

可能只需要更改某些东西的版本。

gradle 包装器:

#Mon Jun 19 08:02:32 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-all.zip

项目分级

buildscript {
    ext.kotlin_version = '1.1.2-5'
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
        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 {
        maven { url 'https://maven.google.com' }
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用分级

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "uk.me.mungorae.aircraft.aircraft"
        minSdkVersion 21
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:25.4.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}

最佳答案

我刚刚通过更新到 Android Studio 3.0 Canary 4 解决了这个问题。

您可以在以下位置下载它: https://developer.android.com/studio/preview/index.html

关于android - Gradle kotlin 不支持的方法 Dependencies.getAtoms(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44693758/

相关文章:

android - 如何在 Fragment 中获取 LifecycleOwner?

android-studio - Android Studio 3.4 Canary 3编译错误

android - 使用Intellij Idea for Flutter时android/app/build.gradle中出现错误

gradle - 检查后在 Gradle Plugin 中运行任务

android - 如何使用 ViewModel(MVVM) 将对象从 fragment 传递到 Activity 详细信息 View ?

java - 如何在 Kotlin 中实现模板方法设计模式?

Kotlin 字符串连接 - 保留多行字符串的缩进

android - 为 android x86 编译 CUPS

android - 如何更新android actionbar中菜单的文本

android - 提交后禁用 fragment 过渡动画