Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – Gradle kotlin不支持的方法Dependencies.getAtoms()大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
刚刚使用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

项目gradle

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
}

app gradle

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()全部内容,希望文章能够帮你解决android – Gradle kotlin不支持的方法Dependencies.getAtoms()所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。