Issue with Kotlin Gradle plugin in android studio - android

I just upgrade Android studio to the last version (3.2.1) and an issue occurred while charging my project. The Kotlin Gradle plugin seems to be incompatible with the current Android Gradle plugin version, or something like that.
Here's the message displayed:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'Projetpelican' is using version 1.2.41.
I can't find any satisfying answer on the web so please enlight me with your knowledge.
PS. A similar topic had already been created but it does not fully answer the question...

in your build gradle
change 1.2.41 to following
buildscript {
ext {
kotlin_version = '1.3.10'
I hope this help you

Update your Kotlin version.
Under your project-level build.gradle (the one outside of the app folder), find the ext.kotlin_version variable and set it to '1.3.11'.
When maintaining an Android project, you need to keep an eye out for yellow-highlighted dependencies. Android Studio doesn't update them for you.

Related

Android Studio 4.2 Kotlin Plugin Issue

Cannot build a new project using Android Studio 4.2 because of the following error:
A problem occurred configuring root project 'My Application'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-release-764.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
When I changed the Kotlin plugin version from ext.kotlin_version = "1.5.0-release-764" to ext.kotlin_version = "1.5.0" app builds successfully but the following warning appears:
Kotlin version that is used for building with Gradle (1.5.0) differs from the one bundled into the IDE plugin (1.5.0-release-764)
Change From
buildscript {
ext.kotlin_version = "1.5.0-release-764"
......}
Change To
buildscript {
ext.kotlin_version = "1.5.0"
....}
Change the Kotlin Version Issue will be cleared.
This is a known bug:
https://youtrack.jetbrains.com/issue/KTIJ-11590
"the problem will be fixed in 1.5.10 update"
I went to the build.gradle file and changed the ext.kotlin_version = "1.5.0" to ext.kotlin_version = "1.4.32", as that was the version of an older project which successfully built.
I was using the same version of kotlin-gradle-plugin bundled with the IDE, which is 1.5.10, in Android studio 4.2.1, and for me disabling the 'Block connections to untrusted servers' in my anti-virus fixed the error.
According to Android Studio's message, Kotlin's latest stable version is 1.5.0-release-764. If you want to (or in this case I guess everyone needs to) use version 1.5.0:
Go to Tools in the menu
Go to Kotlin
Choose Configure Kotlin Plugin Updates
In the drop-down, choose the early access preview version of 1.5.x and then click OK.
Gradle sync will now configure the Studio with Kotlin 1.5.0.
if you work on flutter project ,you just need to update flutter sdk run that command in terminal:
flutter upgrade
After updating , new flutter version will fix that errors automatically.

React Native: What's the difference between gradle references in gradle-wrapper.properties and build.gradle?

In my React Native app, I got an error about incompatibilities with gradle 6, so I looked in my project structure to find out which version of gradle I was running in my project. I found this line in gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
and this line in build.gradle
classpath("com.android.tools.build:gradle:3.4.2")
What I Want To Know: What's the difference between the reference to gradle in each of these files? In other words, how is version 5.5 being used in my project, and how is 3.4.2 being used?
distributionUrl represents Gradel Version where as classpath represents Android Gradle plugin version.
Gradel vs Android Gradle plugin: Reffer this difference between android gradle plugin and gradle
Gradle is the build system.
You can use it with a lot of plugins. One of these is the plugin for Android.
It is used to provide processes and configurable settings that are specific to building and testing Android applications.
For greater details and mapping of the above two type of versions refer the following URLs
https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
https://developer.android.com/studio/releases/gradle-plugin#updating-plugin
I hope this answer has cleared your doubts.

Unsupported method: AndroidArtifact.getBuildConfigFields()

I have just updated to Android Studio 4.0 and trying to build my project. I keep on getting the below error
Unsupported method: AndroidArtifact.getBuildConfigFields().
The version of Gradle you connect to does not support that method.
To resolve the problem you can change/upgrade the target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.
I am already using the latest version of Gradle and Gradle Plugin
Gradle version:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-milestone-1-all.zip
Gradle plugin tools version:
classpath 'com.android.tools.build:gradle:4.1.0-alpha10'
Any solution or fix for this problem would be helpful. Thanks in advance.
Use Android studio 4.1 preview
or
classpath 'com.android.tools.build:gradle:4.0.0'
This is usually due to a mismatch between your Android Studio versions and the Android Gradle plugin.
You can find the version of Android Studio on the project selection window when you first open it (or in "Android Studio > About Android Studio" on Mac, and similar location on other platforms). For example, you might be using Android Studio 4.0.1.
You can find the Android Gradle plugin version for your project in the top-level build.gradle file.
You should find something like the following:
buildscript {
[...]
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
[...]
}
[...]
}
You need to make sure that the two version numbers match (in this case they do).

Plugin is too old

I know this question isn't new, but I really couldn't find the solution for me.
Im getting the
Plugin is too old, please update to a more recent version, or set
ANDROID_DAILY_OVERRIDE environment variable to
"3915652b2897b86e86ec1d347be9193f1139098e"
error while trying to build the project.
build.gradle classpath:
classpath 'com.android.tools.build:gradle:2.2.0-alpha2'
wrapper:
distributionUrl = https\://services.gradle.org/distributions/gradle-2.10-all.zip
now when I`m using lower version of gradle it builds the project but the instant run isn't working because it requires the alpha2.
any ideas?
Current version of gradle plugin is 2.2.0-alpha4
You can find the name of latest version in the Bintray repository or on the badge in the bottom of the answer :)
[ ![Download] 2]3

update Gradle to 2.10 error

I' using Gradle 2.9 in my Android Studio Project.
And today I try to update Gradle to 2.10, but got an error :
I follow the tip and change it to 2.2, but it doesn't work, 2.10 neither.
I use local gradle distribution not the wrapper, so I think this tip looks useless.
It has been marked as bug, which will be fixed in next Android Studio version (1.5.x).
Until then, temporary fix is adding following line in top-level build.gradle:
buildscript {
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
...
}

Categories

Resources