I imported an old project from github to use it in a course, then I received this error message :
Support for builds using Gradle versions older than 2.6 was removed in tooling API version 5.0. You are currently using Gradle version 2.2.1. You should upgrade your Gradle build to use Gradle 2.6 or later.
I suggest you to update your versions to these:
/project/build.gradle
classpath "com.android.tools.build:gradle:4.1.3"
/project/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer.
but my android studio version is 3.2.1 and there is no new update from Google
Try to edit your project build.gradle file and set the android build gradle plugin to classpath 'com.android.tools.build:gradle:3.2.1' within the dependency section.
See also the documentation of the android grade plugin
It's a bit late, But easy and effective.
Click on About Android Studio,
Check the current version,
Open build.gradle of Project and put it in front of the class path. e.g Your studio version is 3.5.2, then your classpath should look like this
classpath 'com.android.tools.build:gradle:3.5.2'
You would need to lower your gradle version and android plugin version, or you can download latest version from beta or canary update channels.
To enable updates from other channels go to Help -> Check for Updates -> Congifure automatic updates and in that dialog select channel you want. After selecting check for update again and it will show you latest version.
This issue is caused due to use of newer version of gradle in the project.
There are two options to resolve this:
Option 1:
Change gradle/wrapper/gradle-wrapper.properties file
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Change project level gradle build.gradle file
classpath("com.android.tools.build:gradle:3.3.2")
Option 2:
Update your Android Studio to newer version. (Highly recommended)
In IntelliJ IDEA this is an open bug: https://youtrack.jetbrains.com/issue/IDEA-252823
As a workaround, you can change the build tools version as other people advise.
My project was failing with this dependency:
com.android.tools.build:gradle:7.0.0-alpha03
Now it's working with this:
com.android.tools.build:gradle:4.0.2
As a side note, you should change that dependency in build.gradle in some projects or in dependencies.kt in newer projects.
That was the most updated version that worked.
After an update the Android Studio does not show the layout's design for some reason. I tried newer versions as well, but it did not work. So I decided to downgrade my IDE.
When I opened my project, I got the same error. The solution was the following:
Open the Project Structure.
Select the Project field.
Use the appropriate Android Plugin Version. You can copy it from a new project's structure.
Change the Gradle version too what you need.
OK.
Find the gradle-wrapper.properties file and open it.
Change the distributionUrl to that gradle version url what you saved in the Project Structure.
Or if you don't mind, then you can update your AS.
Had the same Issue when i decided to install another version of Android Studio, what worked for me was:
Creating a new project with the current version of Android Studio just to go check the classpath version at the project level build.gradle inside the dependencies section, at the time it was this:
classpath 'com.android.tools.build:gradle:3.5.0-rc01'
Copied that line and replaced it on the project i was working on.
in project's build.gradle file comment classpath com.android.tools.build:gradle:. File → Project Structure select Android Gradle Plugin Version to match Android Studio version
You can now update your android studio to 3.4 stable version. Updates for stable version are now available. cheers!!!
i just change gradle version classpath 'com.android.tools.build:gradle:3.5.3' to
classpath 'com.android.tools.build:gradle:3.3.2' and now working.
I encountered with this error and just decrease gradle version and android plugin version to 5.1.1 and 3.4.2.
Close VPN worked for me! It suprised me.
this issue occur for me after downgrade Java JDK, after upgrade JDK my problem resolved.
Open android studio then go to help menu > check for update > Update your Android Studio to newer version.
If u r here because of Jetpack Compose, I had the same problem, and solved it by using the Arctic Fox Canary build of Android studio: you can download it at this link: https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2020.3.1.12/android-studio-2020.3.1.12-mac.zip
This issue arises due to updates, You can resolve this by downgrading the gradle used from
com.android.tools.build:gradle:3.2.1 to a previous gradle like com.android.tools.build:gradle:3.0.0 or anything older than the current one
This usually happens when you're opening someone else's project after unzipping it. And the person has used an updated android Studio.
The way to solve it is
1.Go to Help and about to see your android studio version
2.Go to File>Project Structure> and set your Android Gradle Plugin version to your android studio version
3.Change the Gradle version to the one you usually use.(optional)
Build the project and it should run without any errors
This seems like incompatible gradle plugin vs gradle binary versions. You can find the releases here: Gradle Plugin release and compatiblity
Upgrade your grade plugin and grade binary to compatible versions and the app should start building.
I am using intellij idea 2017.03 and I am using it for android developments. Currently when I create project it takes gradle version as 2.2.3. but current version is 4. So I am trying to make my project gradle version to latest one.
I tried to update it via build.gradle file, but it didn't work. I know that new android studio update will fix this, but in there release notes they have mentioned that Android studio built on intellij idea 2017.03. so how can I make it works?
This is the line you have, right:
classpath 'com.android.tools.build:gradle:2.2.3'
Gradle classpath versions are different from the actual Gradle versions for some reason.
Change the version there to 3.1.4, and make sure you have the following line in gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
My Android Studio giving me an error see below images
but firebase doc gave me a different version of many libraries, here is the doc
So my question is if firebase doc gives me this different version of libraries then why is android studio giving me this error?
Upgrade the version of the version of the google services gradle plugin to the latest in you top-level build.gradle:
classpath 'com.google.gms:google-services:4.0.1'
This is the plugin that checks for proper versions. Only newer versions of this plugin understand the new versioning system of the libraries.
Use the following google service plugin:
classpath 'com.google.gms:google-services:4.0.1'
and upgrade firebase invites:
implementation 'com.google.firebase:firebase-invites:16.0.1'
As per one of comment suggested, Upgrading an Android Studio and Gradle version Did solve my problem, Previously I was using Android Studio 3.0 and after upgrading to Android Studio 3.1.3 this error was gone.
Below are the changes that I have made.
Updated Android Studio from 3.0 to 3.1.3
Updated Gradle Version to 4.4
If this will not fix your problem then try to upgrade your Google plugin version to the latest one
classpath 'com.google.gms:google-services:latest.version'
I am getting following error while building Android project in Android Studio 1.2.2 (fresh instalation)
Error:(76, 0) Could not find property 'unitTestVariants' on com.android.build.gradle.internal.dsl.TestOptions_Decorated#261be0aa.
Gradle version is 2.4
Android build gradle version is 1.2.3
Android-apt version is 1.4
Android SDK version is 19.
This is triggered by the Android apt plugin using the unitTestVariants property in its 1.5 version which is only available in the Android gradle plugin from version 1.3 onwards (cf. bug report).
So for now either use android apt plugin version 1.4, or Android gradle plugin version 1.3 (see instructions below).
Note that gradle version itself doesn't matter as far as this bug is concerned and you could use 2.4 as well as 2.2.1.
Use Android gradle plugin >= 1.3
make sure the projects buildscript block references jcenter() (the beta versions aren't on maven)
replace all instances of 'com.android.tools.build:gradle:1.2.3' by 'com.android.tools.build:gradle:1.3.0-beta4'
re-sync the gradle project from within AndroidStudio
Use Android apt plugin <= 1.4
(courtesy of #emarc-magtanong)
make sure all references to the Android apt plugin read com.neenbedankt.gradle.plugins:android-apt:1.4 and not com.neenbedankt.gradle.plugins:android-apt:1.5 nor com.neenbedankt.gradle.plugins:android-apt:+.
Use gradle 2.4. This happened to me as well and tried for it to work with gradle 2.2.1 changing the build tools and android gradle plugin. The only thing that worked was to update gradle. You can update the gradle wrapper.