3

I am using a beta Kotlin and Android-Studio channel. After update to the latest version i got some gradle sync error.

Below are the log i copied from Event Log:

Error:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39. Searched in the following locations: file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar Required by: project : 

below is the build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.2.0-rc-39' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.0-alpha04' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // 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 } 

below is the app build.gradle:

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 defaultConfig { applicationId "com.udebest.myapplication" minSdkVersion 15 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { postprocessing { removeUnusedCode false removeUnusedResources false obfuscate false optimizeCode false proguardFile 'proguard-rules.pro' } } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } 

Please, anyone has an idea about this? I don't really know how can I solve this? I could not find any solutions out there.

8 Answers 8

7

Change your repositories in buildscript and allprojects into:

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

This works for me.

Sign up to request clarification or add additional context in comments.

1 Comment

I went looking for where this might be documented. The one thing I found was a note at the end of this blog post: blog.jetbrains.com/kotlin/2017/09/kotlin-1-2-beta-is-out about needing to add a repository for the kotlin 1.2 beta. The repo in that post is kotlin-1.2-eap, not kotlin-dev, but both have the packages, I think.
1

First, I updated Kotlin plugin thru tool, Kotlin, configure kotlin plugin update.

After, in App directory, in build.Gradle file search:

repositories { // You need to add the following repository to download the // new plugin. google() } 

I add a new repository

maven { url 'C:/Program Files/Android/Android Studio/gradle/m2repository/'} 

this is the path thru my local directory where the resources are. After this try again to sync

Comments

0

Change and try

classpath 'com.android.tools.build:gradle:3.1.0-alpha04' 

to

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

It may be due to the alpha release of gradle.

1 Comment

i have tried it.. but it still print the same error log. By the way, how do you know which gradle version should you use? Mostly i follow Android Studio when it asks me to update a newer gradle version or when creating project and it selected it for me. Let guild me so i can select the best one.
0

Use below version of kotlin in build.gradle(Project)

kotlin_version = '1.1.4-3' dependencies { classpath 'com.android.tools.build:gradle:3.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } 

Declare dependency of kotlin in build.gradle(Module) as below

compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" 

Comments

0

check your Kotlin version in build.gradle. I got the same issue when the version was 1.1.0 which was added by default. changed to recent version 1.3.21 then it is working fine.

Comments

0

This solution has worked for me for React Native(0.63) after installing react-native-image-picker by Ray Eldath, from above comment

//in android.build.gradle { google() jcenter() mavenCentral() maven { url 'https://dl.bintray.com/kotlin/kotlin- dev/' } } 

Comments

0

First, close Android studio, delete the .gradle folder, and then open Android Studio again, probably as an administrator This will make it sync from the start, and solve the issue.

This issue was resolved for one of my peers.

Comments

-1

Uninstall the Kotlin plugin (Preferences > Plugins > Kotlin > Uninstall) and use the version that comes with the IDE .

1 Comment

it is working perfect when i downgrade Kotlin version to the stable one. But how about installing a beta version instead of stable one to enjoy new features? After uninstall the beta version, it just work fine. But because I wanted to use a beta one, then I try to reinstall it back and the beta one doesn't work. I just wonder how to make a beta one working now. Do you know how? please help.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.