【问题标题】:Gradle Build failing with kotlin exception in flutterGradle Build 在颤振中因 kotlin 异常而失败
【发布时间】:2022-01-16 14:29:06
【问题描述】:

在运行颤振应用程序时,我在 gradle 构建时遇到了失败。这个问题之前不存在,似乎是随机发生的。我不确定我必须做什么来解决它!

   FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.10.
     Required by:
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-native-utils:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.3.50 > org.jetbrains.kotlin:kotlin-scripting-common:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.3.50 > org.jetbrains.kotlin:kotlin-scripting-jvm:1.3.50
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-native-utils:1.3.50 > org.jetbrains.kotlin:kotlin-util-io:1.3.50
      > Skipped due to earlier error
   > Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.10.
     Required by:
         project : > com.android.tools.build:gradle:4.1.0 > com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09
         project : > com.android.tools.build:gradle:4.1.0 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta09
      > Skipped due to earlier error
   > Could not resolve org.jetbrains.kotlin:kotlin-stdlib:1.4.10.
     Required by:
         project : > org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50 > org.jetbrains.kotlin:kotlin-reflect:1.3.72
      > Skipped due to earlier error
   > Could not resolve javax.activation:javax.activation-api:1.2.0.
     Required by:
         project : > com.android.tools.build:gradle:4.1.0 > androidx.databinding:databinding-compiler-common:4.1.0 > org.glassfish.jaxb:jaxb-runtime:2.3.1
         project : > com.android.tools.build:gradle:4.1.0 > androidx.databinding:databinding-compiler-common:4.1.0 > org.glassfish.jaxb:jaxb-runtime:2.3.1 > javax.xml.bind:jaxb-api:2.3.1

Error shown

我的项目/build.gradle 文件如下所示:

    buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.10'
    }
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
    project.evaluationDependsOn(':app')
}

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

任何帮助将不胜感激!

【问题讨论】:

    标签: android flutter kotlin gradle build.gradle


    【解决方案1】:

    更改 kotlin 版本

    ext.kotlin_version = '1.4.32'
    

    【讨论】:

      猜你喜欢
      • 2017-07-05
      • 2022-07-29
      • 2021-01-12
      • 2020-01-17
      • 2022-07-07
      • 1970-01-01
      • 2021-06-13
      • 2021-03-04
      • 2021-06-30
      相关资源
      最近更新 更多