【问题标题】:How do you fix the following error : Could not find method classpath() for arguments如何解决以下错误:找不到参数的方法 classpath()
【发布时间】:2021-02-21 09:26:34
【问题描述】:

我在尝试使用 Android Studio 运行我的 Kotlin 应用程序时遇到以下错误,我不确定为什么,有什么想法吗?

评估根项目“天气应用”时出现问题。

在 org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler 类型的对象上找不到参数 [com.android.tools.build:gradle:5.1.2] 的方法 classpath()。

buildscript {
    ext.kotlin_version = '2.4.30'
    ext.room_version = '3.3.0-beta02'
    ext.navigation_version = '2.0.0'
    ext.kodein_version = '6.2.0'
    ext.lifecycle_version = '3.3.0'
    ext.retrofit_version = '3.9.0'
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }

            }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:5.1.2' // ERROR LINE 17
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'android.arch.navigation:mavigation-safe-args-gradle-plugin:2.0.0-aplha06'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

【问题讨论】:

    标签: android gradle


    【解决方案1】:

    更改类路径:

    类路径“com.android.tools.build:gradle:4.1.1”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-11
      • 1970-01-01
      • 2019-11-22
      • 1970-01-01
      • 2021-03-09
      • 1970-01-01
      相关资源
      最近更新 更多