错误:在 Ionic 3 中找不到 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25 [英] Error: Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25 in Ionic 3

查看:32
本文介绍了错误:在 Ionic 3 中找不到 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在为 Android 构建 Ionic 3 应用程序时突然收到以下错误.

I am getting the following error suddenly while building Ionic 3 app for Android.

Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25

我们有一个来自 Android Studio 的解决方案 这里 但是在我使用以下代码更改我的 build.gradle 之后,我仍然收到错误.

We have one solution from Android Studio here but after I did change in my build.gradle with the following code I am still getting the error.

buildscript {
    repositories {
        ...
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
}

allprojects {
    repositories {
        ...
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }
}

在更新 Cordova 并添加上述解决方案后,我的 build.gradle 文件如下所示.

My build.gradle file looks like this after I updated my Cordova and added the above solution.

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }

    dependencies {
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        classpath 'com.android.tools.build:gradle:3.3.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
    }

    //This replaces project.properties w.r.t. build settings
    project.ext {
      defaultBuildToolsVersion="28.0.3" //String
      defaultMinSdkVersion=19 //Integer - Minimum requirement is Android 4.4
      defaultTargetSdkVersion=28 //Integer - We ALWAYS target the latest by default
      defaultCompileSdkVersion=28 //Integer - We ALWAYS compile with the latest by default
    }
}

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

还是一样的错误.

推荐答案

问题出在 cordova-support-google-services Cordova 插件.

The problem lies in the cordova-support-google-services plugin for Cordova.

截至今天(2019 年 10 月 24 日),此插件的 build.gradle 如下所示:

This plugin's build.gradle looks like this as of today (October 24th, 2019):

dependencies {
    classpath 'com.android.tools.build:gradle:+'
    classpath 'com.google.gms:google-services:4.2.0'
}

更确切地说,问题在于这种依赖:

More exactly the problem lies in this dependency:

classpath 'com.android.tools.build:gradle:+'

这是一种非常脆弱的指定依赖项的方式.这里的+"号表示获取存储库中可用的最新版本".如果在 repo 中发布了较新的版本,并且它破坏了构建,那么每个拥有此插件的人都会破坏他们的项目.这发生在今天.正在获取的损坏版本是 com.android.tools.build:gradle:4.0.0.它需要一些 Kotlin 的东西.

That is an extremely brittle way of specifying dependencies. The '+' sign here means "fetch the most recent version available in the repo". If a newer version is published in the repo, and it breaks the build, then everyone with this plugin has their projects broken. This happened today. The broken version that is being fetched is com.android.tools.build:gradle:4.0.0. It requires some Kotlin stuff.

这就是为什么您需要始终冻结依赖项以可靠地构建您的项目.永远不要相信较新的东西.这个依赖编译得很好,就像昨天一样:

That is why you need to ALWAYS freeze dependencies to reliably build your project. Never trust the newer stuff. This dependency compiles fine just as it did yesterday:

classpath 'com.android.tools.build:gradle:3.5.1'

对于那些使用 Cordova 或 Ionic 的人,您可以通过冻结文件中的依赖项来快速修复以构建项目:

For those using Cordova or Ionic, you can make a quick fix to be able to build the project by freezing the dependency in the file:

<projectroot>/platforms/android/cordova-support-google-services/<project>-build.gradle

虽然这不是最终的解决方案.如果您通过 Cordova 重新安装 android 平台,错误将再次出现.项目维护者应该冻结依赖项或修复它以支持 gradle 4.0.0.在此期间,只需使用此插件的固定分支.

This is not a definitive solution though. If you reinstall the android platform via Cordova the error will show up again. The project maintainer should either freeze the dependency or fix it to support gradle 4.0.0. In the meantime just use a fixed fork of this plugin.

这篇关于错误:在 Ionic 3 中找不到 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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