Android gradle - gradle wrapper - distributionUrl get changed automatically after i edit it - android

I'm trying to change gradle version from 4.1 to 4.4. When i change it manually and i execute "ionic cordova build android", the gradle version get back to 4.1 automatically.
I went to gradle-wrapper.propreties and i changed manually the distributionUrl.
from
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
to
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
Expected results:
the app builds successfully.
Actual results:
the building process stops.
Error message:
Failed to apply plugin [id 'com.android.library']
Minimum supported Gradle version is 4.4. Current version is 4.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\ghassen\Desktop\MyAppBeeMobile\gradle\wrapper\gradle-wrapper.properties to gradle-4.4-all.zip

The gradle version is set inside the gradle-wrapper.jar file itself (e.g. in META-INF/MANIFEST.MF among many other files) and the distributionUrl in the properties file doesn't take precedence.
Try upgrading the gradle version like so:
./gradlew wrapper --gradle-version 4.4

Related

Android Studio Error "Minimum supported Gradle version is 7.0.2. Current version is 6.8."

An error occurred after I downloaded version 6.8 and the latest version of Gradle.
A problem occurred evaluating project ':launcher'.
< Failed to apply plugin 'com.android.internal.version-check'.
<< Minimum supported Gradle version is 7.0.2. Current version is 6.8. If using the gradle wrapper, try editing the distributionUrl...
What do I have to do?
I'm attaching more details in the added pictures.
The error:
Minimum supported Gradle version is 7.0.2. Current version is 6.8.
Likely means:
Your "\gradle"-folder is missing from your project folder:
(Note: Not to be mistaken for the ".gradle"-folder which is a different folder)
Solution:
Get a copy of the "\gradle"-folder from another working project (or create a new project).
Or:
Your "\gradle\wrapper\gradle-wrapper.properties" has an incorrect value in the "distributionUrl=":
Solution:
Change the value in "\gradle\wrapper\gradle-wrapper.properties" to
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
I hade the same problem after moving my project to another computer:
Minimum supported Gradle version is 7.0.2. Current version is 6.8.
Please fix the project's Gradle settings.
Gradle Settings.
Clicking on the "Gradle Settings"-link opened the Gradle settings Window, but the Gradle JDK was already correctly set to version 11:
So my next step was to check the Project Structure:
And update the Gradle Version to 7.0.2:
But that led to this error instead:
¤ What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
» Failed to apply plugin 'com.android.internal.version-check'.
» Minimum supported Gradle version is 7.0.2. Current version is 6.8. If using the gradle wrapper, try editing the distributionUrl in D:\Files\Code-Project\gradle\wrapper\gradle-wrapper.properties to gradle-7.0.2-all.zip
Now the error points me towards a problem within the "\gradle\wrapper\gradle-wrapper.properties"-file.
Looking into that I found out the real problem - the "\gradle"-folder was completely missing.
(Note: The "\.gradle"-folder is not the same as the "\gradle"-folder)
Copying the "\gradle"-folder from another project solved my problems.
Now my "\gradle\wrapper\gradle-wrapper.properties"-file looks like this:
Next update the Gradle Version in Android Studio select invalidate cache and restart solve the issue.
Go to Menu File->Invalidate cache..-> Invalidate and Restart.
Go to gradle wrapper properties
In the distribution url line change gradle version from 6.5 to 7.0.2 or the current version when you see this
The error says that the gradle version in your system is less than your project's gradle verion. That's the reason why it is unable to compile your project.
System gradle version < Project's gradle version
So there are 2 solutions here,
Change the distribution URL in the gradle-wrapper.properties file in the android/gradle/wrapper directory to distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip.
Update your gradle plugin. If you use some environment variable, download the latest verion from Gradle | Manual Installation and replace it with your current one. Don't forget to update the path variable in system properties.

Minimum supported Gradle version is 2.14.1. Current version is 2.10

I am trying to build my project using gradle command line but it keeps throwing exceptions that
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Minimum supported Gradle version is 2.14.1. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in /mnt/c/Users/USER/Documents/Projects/fdroiddata/build/com.simpledecredwidget/gradle/wrapper/gradle-wrapper.properties to gradle-2.14.1-all.zip
Complete error is here
This is my gradle wrapper located at $projectroot/gradle/wrapper and this is the content of my gradle wrapper
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
I have tried all i can but it is not working, as you can see i already modified my distributionUrl and it keeps showing the same error and pointing to the same file, Please help me in any way you can.
Thanks.
You should use gradlew clean build commands if you are using gradle wrapper. Because if you will use gradle clean build command, it will still use your local gradle, I think it is 2.10 version. That's the reason you are getting error. Use gradlew command and firstly it will download gradle 2.14.1 version that you defined in your .properties file and it will download the 2.14.1 distribution under C:\Users\yourusername.gradle\wrapper\dists folder. You need to see the download procedure in command line.
You should use the required version of Android Plugin for each gradle version.
If you are using gradle 4.1+, you should use plugin 3.0.0+.
You can specify the Gradle version in either the File > Project Structure > Project menu in Android Studio, or by editing the Gradle distribution reference in the gradle/wrapper/gradle-wrapper.properties file. The following example sets the Gradle version to 4.1 in the gradle-wrapper.properties file.
More information: https://developer.android.com/studio/releases/gradle-plugin.html

Downgrade Gradle from 3.3 to 2.14.1

Long story short: My android phone keeps disconnecting from ADB. I was told to update android studio, did that. I open my project in Intellij and try to run on android and I get an error:
BUILD FAILED
Total time: 48.986 secs
Error: /Users/me/Desktop/comp/Development/comp-ionic/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> java.lang.NullPointerException (no error message)
My first thought is that my gradle is the wrong version. For this specific app, I need to use gradle version 2.14.1.
When I type gradle -v I'm getting version 3.3.
Is there a way to delete/downgrade gradle from 3.3 to 2.14.1?
Or is this another problem?
If you're using the gradle wrapper, then there'll be a folder in your project named "gradle" with a subfolder named "wrapper", inside that, there are 2 files:
- gradle-wrapper.jar
- gradle-wrapper.properties
Open "gradle-wrapper.properties" and change the place where it says "3.3" to "2.14.1". Then sync gradle, and it will automatically download 2.14.1.
If you're using the new 2.3 Android Studio, you HAVE to use gradle wrapper 3.3, as its the minimum supported gradle wrapper version. If so, then you'll have to download Android Studio 2.2, or fix whatever issue you have in your project that needs gradle wrapper version 2.14.1.
To get more information about whatever the issue is, try running this:
./gradlew clean assemble -stacktrace
That will clean your project, try and compile it, and if/when it fails, it will show you a stacktrace of the error.
What you should do is to change the gradle build tools version to the one that matches your gradle version. According to here you can set the gradle to 2.14.1 by changing build tools to lower than 1.0.0.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'// For gradle 2.2.1 - 2.3
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Notice: if you keep checking the mentioned link you'll see Higher is better for gradle.
For me, Android Studio > File > Invalidate Caches / Restart did the trick.
I got the same problem when upgrading to Android Studio 2.3.1. There is something funky about Gradle 3.3 (It fails by "java.lang.NullPointerException: null value in entry: destinationDir=null at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)").
Good news: seems like the current most recent version (3.5) works.
Go to File|Project Structure|Project, and use these versions:
Gradle version=3.5
Android Plugin version=2.3.1
I update the Android Studio version to 3.3 Canary 4, then update the gradle plugin, and the project stops working.
I do not know how to restore my AS to the previous state, nighter the gradle plugin.
But just with this command, the project now works, for me: gradlew clean assemble -stacktrace, in terminal tab in AS.

Gradle version 2.10 is required. Current version is 2.5 Error?

I'm writing an application and trying to execute task using Terminal command gradle task1 created in app/build.gradle file. But it giving following error.
Gradle version 2.10 is required. Current version is 2.5. If using the
gradle wrapper, try editing the distributionUrl in
/home/user/workplace/Project/gradle/wrapper/gradle-wrapper.properties
to gradle-2.10-all.zip
I checked with gradle-wrapper.properties and there distributionUrl attribute pointing same 2.10 version. distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip
what is wrong here, any suggestion !!
Ahh..that is because I was trying to build task using Gradle install on local machine. Instead I tried with project directory
./gradlew task1
and this worked fine.

Getting error "Gradle version 1.10 is required. Current version is 1.12." when executing "gradle wrapper"?

I'm trying to execute gradle wrapper for an Android project, and this error is raised:
A problem occurred evaluating root project 'myapp'.
> Gradle version 1.10 is required. Current version is 1.12. If using the gradle wrapper, try editing the distributionUrl in /Users/dude/myapp/gradle/wrapper/gradle-wrapper.properties to gradle-1.10-all.zip
My wrapper task in build.gradle looks like this:
task wrapper(type: Wrapper) {
gradleVersion = "1.12"
}
I recently updated to Gradle v1.12 via Homebrew. Is it not supported or something? If so, where can I check this sort of thing?
A particular version of the Gradle Android plugin requires a particular version of Gradle (at least for now), and it seems that your version of the Gradle Android plugin requires Gradle 1.10. You might find more information on this in the documentation for the Gradle Android plugin.
PS: The wrapper task above creates the files necessary to run Gradle with the (generated) gradlew script, which is the preferred way to run Gradle (no manual install, every build can specify in its gradle-wrapper.properties which Gradle version it needs).
The version of Android gradle plugin needs to be compatible with the version of Gradle. Checkout the version compatibility mapping table here:
http://tools.android.com/tech-docs/new-build-system/version-compatibility
I had the same problem. It turned out that the old Android Studio created gradle related files one level above my application folder. In my case, the path was in ~/git/, and my project was at ~/git/myproject. I used Android Studio RC2 now, and no matter how I changed the config within the project, gradle still wanted to use the old 1.10 version. Therefore, I re-checked out the project a new path, and updated the gradle version reference within the project, then it compiled.

Categories

Resources