kotlin runtime below plugin version - android

My android studio is sending me this warning:
Outdated Kotlin Runtime
Your version of Kotlin runtime in 'Gradle:
org.jetbrains.kotlin:kotlin-stdlib:1.2.10#jar' library is
1.2.10-release-109 (1.2.10), while plugin version is 1.2.41-release-Studio3.1-1.
Runtime library should be updated to avoid compatibility problems.
This warning appear every time I open the project and it finishes the Gradle sync How do I update the Kotlin runtime?
I have found questions about it, but all of them the problema was that the plugin version that was below runtime and needed to update the plugin version on the build.gradle file, but my case is the opposite. My build.gradle is like this:
buildscript {
ext.kotlin_version = '1.2.41'
ext.anko_version='0.10.5'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If I try to downgrade the plugin to 1.2.10, them the IDE gives a warning that the plugin is outdated.

Related

Getting Error Process unexpectedly exit in Android Studio Version 4.0

I am having Android Studio Version 4.0 and using gradle in gradle.project
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
// 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
}
I am getting error Process Unexpectedly Exit.
Please help me to fix this issue
Go to File->Project-Structure->Project
Change Android Gradle Plugin Version to 3.3.2 or the last stable version for you Let the Gradle Version to 5.1.1
Click Ok and sync

Android Stuido: How to change Kotlin version that is used for building with Gradle

Android Studio is giving a warning saying: "Kotlin version that is used for building with Gradle (1.3.10) differs from the one bundled into the IDE plugin (1.3.41)".
How can i change the Kotlin version used by Gradle?
I have installed the latest Android Studio version(3.4.2) with the latest Kotlin plugin(1.3.41-release-Studio3.4-1)
I have also tried to change the kotlin version in the build.gradle file, but its saved in a variable "kotlin_version$"
dependencies {
// ....
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
I have also tried to change the kotlin version in the build.gradle file, but its saved in a variable "kotlin_version$"
That variable is defined earlier in the file. Here is a typical top-level build.gradle file:
buildscript {
ext.kotlin_version = '1.3.41'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The second line of that file is:
ext.kotlin_version = '1.3.41'
That is where kotlin_version is defined, that is then used in "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version".
So, change ext.kotlin_version to be the value that you want.

Could not find com.android.tools.build:gradle:4.4

I just migrated gradle from 3.0.1 to 4.4. Now Android Studio showing gradle build failed showing below errors.
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com.android.tools.build:gradle:4.4.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/4.4/gradle-4.4.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.4/gradle-4.4.jar https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.4/gradle-4.4.pom https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.4/gradle-4.4.jar
Project level build.gradle file is following below
buildscript {
repositories {
jcenter()
google()
}
dependencies {
//classpath 'com.android.tools.build:gradle:3.0.1'
//replaced by 4.4 below
classpath 'com.android.tools.build:gradle:4.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
mavenCentral()
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Project structure is shown below.
You mixed up with plugin version and distributionUrl. Plugin version should be classpath 'com.android.tools.build:gradle:3.0.1' or com.android.tools.build:gradle:3.1.0. Read Android Plugin for Gradle Release Notes.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
And distributionUrl to GradleWrapper.
distributionUrl = https\://services.gradle.org/distributions/gradle-4.4-all.zip
Currently latest Version 3 gradle plugin available on android for which you have to use classpath 'com.android.tools.build:gradle:3.1.0'.
To be up to date see Configure Your Build.
Guess you mixed up Gradle and Android Gradle Plugin regarding their versions?
The latest Android Gradle Plugin is v4.0.0 as of April 2020, which maps to Gradle v6.1.1.

Android studio kotlin plugin error

In android studio im getting an error:
Plugin Error: Kotlin threw an uncaught AbstractMethodError. Disable Plugin
Yesterday everything was fine.
Gradle:
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
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
}
}
Android studio version: 3.0.1 Build #AI-171.4443003
Even more: if i create new android project with kotlin support in fails with the same error.
#EDIT1
Full root gradle build script.
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
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()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
1.1.60 does not help. Still same error. And still getting
Your version of Kotlin runtime in 'org.jetbrains.kotlin:kotlin-stdlib:1.1.51#jar' library is 1.1.51, while plugin version is 1.1.60-release-Studio3.0-1.
Even after updating to 1.1.60
Plugin Error: Kotlin threw an uncaught AbstractMethodError.
You should upgrade kotlin_version. Use 1.1.60 instead of 1.1.51.
ext.kotlin_version = '1.1.60'
NOTE
1.1.60 is BUGGY. Downgrade your Version.
Then Clean-Rebuild-Gradle.
As #IntelliJ Amiya mentioned downgrading kotlin plugin back to 1.1.51 did the trick.
1.1.60 buggy(

Could not update Firebase version to 11.4.2

I am trying to upgrade the version of Firebase to 11.4.2
I made the following changes in my project:
in project gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:3.1.0'
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and my module gradle file:
compile "com.google.firebase:firebase-messaging:11.4.2"
I am getting this error when I build the project:
Error:Could not GET
'https://maven.google.com/com/google/firebase/firebase-messaging/11.4.2/firebase-messaging-11.4.2.pom'.
Received status code 403 from server: Authentication required
To fix the problem:
Download Android Studio 3.0 version
Update the Gradle plugin to classpath 'com.android.tools.build:gradle:3.0.0'
Update gradle wrapper version of the project to: distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-all.zip
The build tools must be at least 26.0.2
if you are working with proxy, you must configure your project gradle.
With new Android Studio 3.0 the error list suggests a "link" "Add Google Maven repository and sync project", which will change build.grade (Module:...) repositories to:
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
**google()**
}
that fixed my problem.

Categories

Resources