android - Error: Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.60-eap-25 in Ionic 3




cordova ionic-framework (5)

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

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' }
    }
}

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
}

Still the same error.


EDIT 10/28/19:

cordova-support-google-services was updated today to version 1.3.2 which changes the classpath from classpath 'com.android.tools.build:gradle:+'

to

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

which seems to fix the kotlin error

Original Answer

I got mine to build successfully by doing the following:

I edited platforms->android->cordova-support-google-services->myAppName-build.gradle

and changed

maventCentral()

to

    maven { url "https://maven.google.com" }
    maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }

That solved the kotlin error then I was getting a different error that I resolved by changing

classpath 'com.google.gms:google-services:4.2.0'

to

classpath 'com.google.gms:google-services:4.1.0'

It then built successfully.


As a further temporary fix to follow-up on the suggestion from @MisterSmith, use a hook to re-apply the lock:

<hook src="scripts/fix_android_dep.sh" type="after_platform_add"/>

with this overly wordy bash code:

#!/usr/bin/env bash

## temporary fix for android studio EAP issue
## SOURCE: https://.com/a/58536638/56545
if [ -d "platforms/android/cordova-support-google-services" ]; then
  file="platforms/android/cordova-support-google-services/app-build.gradle"
  from="classpath 'com.android.tools.build:gradle:+'"
  to="classpath 'com.android.tools.build:gradle:3.5.1'"

  change=`sed "s/$from/$to/" < "$file"`
  echo "$change" > "$file"
fi

None of the above worked for me. I ended up removing the google-services plugin and add it.

cordova plugin rm cordova-support-google-services cordova plugin add cordova-support-google-services


Solution for ionic v3 and cordova

@Mister Smith solution solved my problem

you have to go to the file

platforms/android/cordova-support-google-services

then

Replace

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

by

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

@Alternative solution I have found is to

setup kotlin in your system :)

in my project i fix like this.(my project in kotlin)

buildscript{

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

}

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




build.gradle