Android Studio 4.2 Kotlin Plugin Issue - android

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.

Related

Could not find com.android.tools.build:gradle:7.3.3. error found in build.gradle file

Could not find com.android.tools.build:gradle:7.3.3.
Searched in the following locations:
- https://plugins.gradle.org/m2/com/android/tools/build/gradle/7.3.3/gradle-7.3.3.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.3.3/gradle-7.3.3.pom
Required by:
project:
The "com.android.tools.build:gradle:$version" is what we called Android Gradle Plugin(AGP), its latest stable version is 7.0.4 (until 1st Jan 2022), you can check all available versions here.
The 7.3.3 is for the Gradle platform itself, you can check all available versions here.
For their relationship, please check here.
Changes the Gradle JDK to jdk-11 helped me:
change gradle jdk version worked for me
go to File, Settings, Build, Execution, Deployment
build tools, gradle
Change Gradle JDK from the dropdown. I use Android Studio java home
You need to add google in the repositories block
in app level build.gradle file:
Because android gradle plugin resides on google repository
allprojects {
repositories {
google()..
}
I tried gradle 7.4.2 and everything is working fine now
https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
go to File, Settings, Build, Execution, Deployment
build tools, gradle
Change Gradle JDK from the dropdown. I use Android Studio java home

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).

Issue with Kotlin Gradle plugin in android studio

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.

Could not find gradle 3.1

The latest version of gradle is 3.1 enter link description here
but Android Studio is only using 2.2?
enter link description here
This seems likes a huge discrepancy. My configuration:
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2'
classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:3.2'
classpath 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
}
}
allprojects {
repositories {
jcenter()
}
}
When I try to find gradle 3.1, I get an error that it cannot find it. Same now with 2.2 > Could not find com.android.tools.build:gradle:2.2.
But gradle -v shows
gradle -v
------------------------------------------------------------
Gradle 2.2
how do I resolve this?
You are confusing Gradle with the Android gradle plugin, which generally matches the version of Android Studio. The latest version (at time of writing) is 2.2.2. It is generally set in your project's base build.gradle as you have shown above.
The Gradle wrapper is what you're looking for. You can change the wrapper's settings in your project's gradle/wrapper/gradle-wrapper.properties file.
Change
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
Again, this is separate from the Android gradle plugin, which simply marries Gradle with Android Studio.
Find all distributions here
Here is the Gradle Version Compatibility for Android Studio
Gradle
refer to link
A problem occurred research project ': sample'.
Failed to apply plugin [id 'com.android.application']
Minimum supported Gradle version is 3.3. Current version is 3.2.1.
The current gradle configuration is also changed to 3.3. The project is running without problems, but can not use the command line (gradle and ./gradlew).
Refer to the online program:
1. Modify gradle-wrapper.properties, and Invalidate Caches / Restart ..., or do not work.
Later in the gradle forum to find a program: Thank you Henry
As new release with the fix not available yet, the former walk-around works fine.
Buildscript {
System.properties ['com.android.build.gradle.overrideVersionCheck'] = 'true'
...
}
. So mark what.
Correction statement : I later found that I installed the sdkman tool,
the tool installed 3.2.1 version, and this should be related (⊙ o ⊙)!
. At the beginning of the show gradle version, will show 3.2.1
version (I am still very depressed, change or show 3.2.1), I have
changed to the environment variable 3.3. I set the gradle environment
variable first, the following is set sdkman environment variable (this
order may also affect). So the final reason is still installed 3.2.1
version.

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