错误:在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

查看:1330
本文介绍了错误:在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 科尔多瓦插件.

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

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

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:+'

这是指定依赖项的一种极其脆弱的方法.此处的"+"号表示获取存储库中可用的最新版本". 如果在存储库中发布了较新的版本,并且该版本破坏了构建,则使用此插件的每个人的项目都将被破坏. 这件事今天发生了.正在获取的已损坏版本为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天全站免登陆