How to upgrade the gradle in a react native app - android

I am working on a react-native project which has gradle version of 4.4 (can be found in project folder /android/.gradle/4.4) but I want to upgrade it to latest one which is 6.0.1. Please help me
I want to change the version in red to 6.0.1(latest) not the one in white

Inside android>gradle>wrapper>gradle-wrapper.properties
update the distributionUrl to your specific gradle like :
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
Hope it helps. feel free for doubts

Change gradle version here:
android/gradle/wrapper/gradle-wrapper.properties
in:distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
Then you need to change the plugin version in:
android/build.gradle
classpath("com.android.tools.build:gradle:4.2.0")
You can see the gradle version for each plugin here:
https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle

In android/build.gradle you have to edit this line
classpath 'com.android.tools.build:gradle:x.y.z'
Change x.y.z with the version you want. Edit it with Android Studio then click Sync now

Related

How I can fix "Warning: Mapping new ns" about flutter in vsc

I try this one
when I try to "sync project with gradle files" a warning pops up
but I can't find buildToolsVersion
and
I try to search for solution for fix this problem
the other is download gradle
but I can't install anywhere
then
please help me to fix this problem
thankyou for your kindness
https://www.img.in.th/image/PQZxbH
ensure your sdk version and build version match up, I had the same issues because my build version in android/app/build.gradle targetSDKVersion wasn't the same as my sdk version in my emulator. I now have them both set to 30 and this went away
It might be a little bit late for you but I write a solution for this problem for those who have the same problem:
Go to android/gradle/wrapper/gradle-wrapper.properties and add the replace the distributionUrl=.... with the following line:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
Go to android/build.gradle and replace the com.android.tools.build line with the following:
buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.1.1' } }
Go to android/app/build.gradle and update the android/app/build.gradle. For example:
android { compileSdkVersion 31}
run flutter clean in the terminal.
This solves the Mapping new ns Problem, but in the future you might want to upgrade your gradle build tools version, compiled SDK Version or gradle version, so these version numbers can be changed but AGP
and Gradle versions have to be compatible.
here you find which Android Gradle Plugin Version is compatible with which Gradle Version.

Error "Minimum supported Gradle version is 5.1.1. Current version is 4.4.1" after update android studio

I updated android studio from 3.3 to 3.4 version and after install and do ./gradlew lint I am getting the next error:
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 6.0.
Then I use the next command to get more details:
./gradlwe build --warning-mode=all
And I get the next message:
Failed to apply plugin [id 'com.android.application']
Minimum supported Gradle version is 5.1.1. Current version is 4.4.1. If using the gradle wrapper, try editing the distributionUrl in .gradle/daemon/4.4.1/gradle/wrapper/gradle-wrapper.properties
to gradle-5.1.1-all.zip
And when I edited my gradle-wrapper.properties, I see that the changes were already done, I.E. the version of the distributionUrl already was gradle-5.1.1.-all.zip
Any idea that how can resolve this?
You could just edit YOUR_APPLICATION_FOLDER/gradle/wrapper/gradle-wrapper.properties and change the last line to:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Android Studio will download necessary library.
This was my solution.
My_project
/gradle
/wrapper
/gradle-wrapper.properties
Modify this line with the Gradle 5.1.1
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
Finally, I was able to solve this dropping the folders of the oldest version in ~/.gradle/wrapper/dists and leave only the gradle-5.1.1-all
In my case, gradle failed to download the version I specified though I tried all previous solutions.
Apparently, I was opening my project by selecting "MyProject/App" directory. Gradle successfully updated when I opened the same project by selecting the "MyProject" folder.
Check your full project and find all "Gradle-wrapper.properties" files. If your project has multiple modules then there are chances of having multiple. and set -
distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip
Gradle sync
If not done then invalidate the cache and restart the project.
Still not working then go to your root directory on Linux and find .gradle folder. Delete it and restart the android studio.
If you use Ubuntu and all above answers didn't solve your problem try to upgrade gradle on your Ubuntu with this commands from this answer https://askubuntu.com/a/975018/714791
sudo add-apt-repository ppa:cwchien/gradle
sudo apt-get update
sudo apt upgrade gradle
It will help I hope
I resolved by two below steps.
delete gradle folder
check your classpath 'com.android.tools.build:gradle:{$gradleVersion}
My gradleVersion is 3.5.3.
I solved this by changing the distributionUrl in gradle-wrapper.properties in gradle/wrapper, not gradle.properties
Maybe it's your gradle environment variable.
execute 'gradle -v'
Check that the gradle version of the project matches the gradle environment variable version
those who are still facing issue with Cordova/Ionic, this is due to CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL which is being checked at platforms/android/cordova/lib/builders/GradleBuilder.js
set CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL to desired distributional
for MacOs
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL = https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
I think it's very important to mention which IDE you're using and what are the configurations.
What made me upset was, I had a setting in gradle-wrapper.properties file which was "ignored" to my mind.
I've found the settings in the IDEA application settings, there:
and then selecting:
and everything works as expected.
Deleting 'all other' locally cached versions can never be the right solution ;)
Good luck!
My app is using Cordova v9.0.0
distributionUrl is set at platforms\android\cordova\lib\builders\ProjectBuilder.js
You can set distributionUrl from the command line with
set CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https://services.gradle.org/distributions/gradle-[version]-all.zip"
Replace [version] with your preference
it solved for me
get the flutter SDK directory
this is my flutter Sdk
C:\flutter\.pub-cache\hosted\pub.dartlang.org\connectivity_macos-0.1.0+2\android\gradle\wrapper
change gradle-wrapper.properties
Modify this line with the Gradle 5.1.1
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
I had the same error: Error "Minimum supported Gradle version is 6.1.1. Current version is 5.1.1" but when I opened the gradle.properties and I found this "distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip" which was correct but wasn't working. To solve this, I deleted the ".gradle" file in the explorer, reopened the app and found out the distributionUrl had change to 5.2.2-all.zip in gradle.properties; I then edited to 6.1.1-all.zip and sync and everything worked like a charm. I hope this can help someone else.
Try to download manually Gradle-5.1.1 from https://gradle.org/releases then go to file/project structure/project and put the new version in gradle version. (You can also use this link - jenv.io/candidate/gradle)
I was having the same problem after migrating from android.support library to androidx where junit library start with androidTestImplementation and not
testImplementation.
So i changed
testImplementation "junit:junit:$rootProject.junitVersion"
to
androidTestImplementation androidx.test.ext:junit:1.0.0-beta01
or
androidTestImplementation "junit:junit:$rootProject.junitVersion"
Remember to append android before testImplementation
also, try removing all older/unwanted versions of gradle using:
cd usr/local/Cellar/gradle/
Don't forget to run the gradle wrapper in your project: https://docs.gradle.org/6.4.1/userguide/gradle_wrapper.html#sec:adding_wrapper
Delete gradle folder from your project directory as well as from the app directory.
restart Adroid studio and resync gradle.
it will solve your problem. If not you might be opened the project yourproject/app. close Android studio and import your project after selecting yourproject. Then resync gradle. This will solve your problem.
For Windows 10:
Go to C:\Users\<user-name>\.gradle\wrapper\dists and delete everything there. Android studio will download the appropriate version afterwards.
If anyone is still searching for a solution after trying literally everything, here's what worked for me.
In the .gitlab-ci.yml file, my image: key was outdated and was writing in the script that Gradle was set to 5.1.1 even though everything in my Android Studio was 7.0.2. After talking to the guy who wrote the image script, I just had to increment the version of that.
https://forum.gitlab.com/t/set-specific-version-of-gradle-for-ci-build/41716/4
This error was solved by restarting Android Studio.

Android Studio 2.2 Gradle update fails

New Android Studio ask me about Gradle plugin update
But it fails, when I press Update button.
Failed to update the version of Android Gradle Plugin
How to fix this?
Looks like it's an inner bug of Android Studio
I just change manually
compile 'com.android.tools.build:gradle:2.1.3'
in root build.gradle to
compile 'com.android.tools.build:gradle:2.2.0'
And all started working.
Download gradle this link manually and copy gradle folder
https://services.gradle.org/distributions/gradle-2.14.1-all.zip
Last version :
https://services.gradle.org/distributions/gradle-3.1-all.zip

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

Android studio : gradle project sync failed

im studying android development for a month
and in my project the gradle version is
code:
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
today when i lunched to android studio i got the error
"Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to..."
what should i do?
how to update for the latest version gradle?.
Thanks for the help!
Looks like alpha6 is out now - https://bintray.com/android/android-tools/com.android.tools.build.gradle/view
I think you have update you sdk and tool, so try the new plugin, maybe alpha4 to alpha6 version:
classpath 'com.android.tools.build:gradle:2.0.0-alpha5'
I have same problem you can find version of gradle here:
https://bintray.com/android/android-tools/com.android.tools.build.gradle/view
and change the version to
classpath 'com.android.tools.build:gradle:2.0.0'
also you have error importing this version you can change the version of grader home in gradle-wrapper.properties to:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip
rebuild project and it should work

Categories

Resources