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(
Related
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.
I tried to build my ionic application on Android using Capacitor. But when I tried to build and run an application on android studio, it gives this error. I don't have any android studio knowledge. The error:
Could not find method allprojects() for arguments [build_al8rrgnflynwtjpadzojip71i$_run_closure1#68017a4f] on settings 'android' of type org.gradle.initialization.DefaultSettings.
The build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.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
}
Instead of allprojects in root project gradle, there is another repositories block in dependencyResolutionManagement, which worked for me.
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.
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.
My project at run time, there was a gradle version of the error, I tried a lot of ways are not resolved, we have not encountered a similar error, the following is the error log.
Error:(1, 0) Gradle DSL method not found: 'apply()' Possible
causes:The project 'xindatx1.6.0' may be using a version of the
Android Gradle plug-in that does not contain the method (e.g.
'testCompile' was added in 1.1.0). Fix plugin version and sync
projectThe project 'xindatx1.6.0' may be using a version of Gradle
that does not contain the method. Open Gradle wrapper fileThe build
file may be missing a Gradle plugin. Apply Gradle plugin
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.novoda:bintray-release:0.8.1'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}