I am facing an issue with my Gradle version whenever i want to generate a signed app - android-studio

Gradle Error
I am facing the above error in Android Studio since a lot of time and I am unable to generate an App. I have update the Gradle version manually from the editor as you can see in the image below
Gradle version I upgraded manually but still it says to generate a signed apk you must update your Gradle version to 3.2.0 or higher. PLEASE SOMEONE HELP ME...
I have tried anything but nothing works for me

Related

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

So I was building out a test APK in Android Studio tonight that had to be signed. It failed and said my Gradle was out of date. So I upgraded my gradle from 7.3.3 to the newest 7.5.1
I changed the wrapper setting to distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
and then I changed my build.gradle dependency to classpath 'com.android.tools.build:gradle:7.5.1'
Note that after doing the changes, and restarting Android Studio, it did upgrade the version in the app directory.
Here's the error getting thrown below:
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.5.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
Required by:
project :
Note that this was a project from a client, and I did not write this originally. These dependencies were in place, but fairly recent, and the app would build fine with it using 7.3.3. However it wouldn't let me sign my app.
I suppose I could use some wisdom on both of these issues. What I'm going to do is go back to version 7.3.3, build the signed APK again, and copy that exact error to report back here with. It was a gradle version error.
For any any Flutter noobs like myself passing through, this error occured because the Android Tools Plugin version DOES NOT match the Gradle Version:
https://developer.android.com/studio/releases/gradle-plugin#groovy
They match up just vaguely enough in number, that you would think that my line com.android.tools.build:gradle:7.5.1. uses gradle 7.5.1, but instead, Android Tools for Gradle is actually a separate entity, and at 7.3.3 as of typing this reply.
So you CAN set your Gradle to the newest version somewhere else in your project, but it has to match the compatible Android Tools version, which is set here. Its silly and confusing at first, and can easily trip up newcomers. Hopefully the versions diverge enough, or the code syntax changes for some better clarity, but as of now, this is it.

How to fix different versions of dependency error?

I had a application made in 2019.
I recently updated the application with few changes.
Android Studio asked me to update to its latest version, so I did. It also asked me to update Gradle to its latest version, so I did it again.
Android Studio also suggested me to update the dependencies. One of the dependencies was com.google.android.gms:play-services-location I did update it to version 18.0.0.
I selected Build > Clean Project and Build > Rebuild Project.
After that I could not successfully build the application. Android Studio builder reported a lot of issues.
One one of them give me this error:
com.google.android.gms.tasks.RuntimeExecutionException: com.google.android.gms.common.api.ApiException: 17: API: LocationServices.API is not available on this device. Connection failed with: ConnectionResult{statusCode=SERVICE_INVALID, resolution=null, message=null}
Why in the error appears 17 while I updated the dependency to version 18?
What can I do fix this error?

How to solve the issue of mixing version of support libraries in Android Studio?

I received an update to android SDK. After the update, when I open a project, Android Studio recommends to update Android Gradle to v 2.3.0 and Gradle to v 3.3. I updated the project as recommended. After that I found an ugly red line under the appcompat-v7:25.2.0' (see pic).
The error, according to android studio, is that I am mixing versions of support libraries (v 25 and 24), but I didn’t find any support library of v24. I tried to build a signed apk, but app build failed (using V2 / full apk signature), so I searched the web and I found one solution to this problem by adding this line to the build.gradle: multiDexEnabled true. Adding that line fixed the problem of generating signed apk, although the red line of error was still there, it didn’t get rid of it.
Then I installed the signed apk on two phones, one running Android 6.0 and the other one is running Android 4.4.2. The app runs smoothly on Android 6.0 and crashes on start on Android 4.4.2 (I set minSdkVersion to 19).
My questions are: how can fix that error in the gradle permanently? Is adding the line “multiDexEnabled” to gradle really needed? How can I run my app on android 4.4.2 without crashing?
I'm had the same issue, just add these lines:
compile "com.android.support:animated-vector-drawable:${supportLibVersion}"
compile "com.android.support:mediarouter-v7:${supportLibVersion}"
In your case supportLibVersion is 25.2.0.

Android Studio 2 error

I have the latest Java version installed as you can see, but it still tells me the message. Moreover, I can not load any projects because it gets stuck in the gradle building process. Any idea?
It is working fine after reinstalling the JDK(500mb) pack, rather than the update (66mb).

Android studio preview 0.4.5: The project is using an unsupported version of the Android Gradle plug-in

I got the following error message when I was importing a project from github:
Failed to refresh Gradle project 'XXX'
The project is using an unsupported version of the Android Gradle plug-in.
Fix plug-in version and re-import project
This is not a duplicate of this because your get thee error message before
gradle/wrapper/gradle-wrapper.properties
is generated.
The problem appeared after updates. The updated Android Gradle plug-in did not support the outdated version of Gradle I had. But the error message is misleading, if you don't attempt different build options you won't see what the problem is.
After downloading a newer version of Gradle, Imported the project again, then:
Use local gradle distribution
Then Gradle home set to the folder where the new version of gradle was downloaded
that solved it
Edit: From Scott (below comments) : It's preferable to use the wrapper and to change the Gradle version in gradle-wrapper.properties instead of downloading and installing Gradle yourself. As for the Android-Gradle plugin, that's set in the dependencies.classpath block in your build file; see this
I get this gradle-errors in 4 Studio updates! My solution: I copy the Studio-folder, and if gralde throws an error, I copy the old version back. It's not a good way, but until google is not able to deliver an update without producing always the same errors (even if mentioned in many forums), I stay on 4.9 and wait for the first final release.

Resources