Upgrading React Native app to Gradle 7.4 errors - android

I'm trying to upgrade to the latest version of React Native. When I run my Android app (npx react-native run-android) it gives this error:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.version-check'.
> Minimum supported Gradle version is 7.4. Current version is 7.3.1. If using the gradle wrapper, try editing the distributionUrl in /Users/justintoth/Dev/m365-mobile-app/android/gradle/wrapper/gradle-wrapper.properties to gradle-7.4-all.zip
Seems simple enough, that I need to upgrade Gradle from version 7.3.1 to version 7.4. However, when I make the following changes:
android/build.gradle (dependencies section):
classpath("com.android.tools.build:gradle:7.4")
android/gradle/wrapper/gradle-wrapper.properties:
distributionUrl=https://services.gradle.org/distributions/gradle-7.4-all.zip
Then it gives this error:
> Could not find com.android.tools.build:gradle:7.4.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/7.4/gradle-7.4.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.4/gradle-7.4.pom
Required by:
project :
So what gives? It errors if I use version 7.3.1 and insists I use 7.4, and yet when I use 7.4 it says it can't find it. The distributionUrl that I specified in gradle-wrapper.properties is correct, so it's clearly ignoring it and just trying to look in google, jcenter and mavenCentral.

Related

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

I faced the problem, more correct in gradle, when I enter the command - npx react-native run-android into the console - it gives me the following error :
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'Da'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find com.android.tools.build:gradle:6.4.1.
Searched in the following locations>
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/6.4.1/gradle-6.4.1.pom -https://jcenter.bintray.com/com/android/tools/build/gradle/6.4.1/gradle-6.4.1.pom
Initially - the problem was incompatibility between gradle and android versions, but after i changed version of gradle and terminal automatically download new version into directory, first error disappeared, but i got another (current problem). I had try some advice before asking question in StackOverFlow, but they didn't work. Here some characteristics :
React-Native Doctor image
Gradle code : gradle.properties ,
gradle-wrapper.properties
Gradle Directory : Here
Path variables :Here
I appreciate all help (I think, that issue is in PATH, but not sure). By the way - does anyone know, how to add pictures without link?
You are confusing gradle with the gradle plugin.
The gradle plugin 6.4.1 doesn't exist.
Use the latest stable version:
classpath 'com.android.tools.build:gradle:4.2.2'
Check also the compatibility with the gradle version:
Plugin version Required Gradle version
4.0.0+ 6.1.1+
4.1.0+ 6.5+
4.2.0+ 6.7.1+

What is navigation.json in Android Studio 4.1?

I just tried out Android Studio 4.1 today. I started the Android Studio and created empty activity and I run it using the android virtual device. Then it was failed and this error is shown:
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:processDebugManifest' (type 'ProcessMultiApkApplicationManifest').
> File 'E:\Project\AndroidLayout\app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml' specified for property 'mainMergedManifest' does not exist.
When I rebuild the project, the error message is shown here:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: E:\Project\AndroidLayout\app\build\intermediates\navigation_json\debug\navigation.json (The system cannot find the path specified)
Note that this is fresh install and fresh project without any modification in the code.
UPDATE 1:
Youtube: https://www.youtube.com/watch?v=g4w_NOA_UVQ
Bug Report: https://issuetracker.google.com/issues/170720311
UPDATE 2:
After I downgrade the Android Gradle Plugin version from 4.1.0 to 4.0.2 and the Gradle version from 6.5 to 6.4.1 now it is working.
So my conclusion is there is a bug in the Android Gradle Plugin 4.1.+ and Gradle 6.5.+.
I find a temporary solution:
After I downgrade the Android Gradle Plugin version from 4.1.0 to 4.0.2 and the Gradle version from 6.5 to 6.4.1 now it is working. So my conclusion is there is a bug in the Android Gradle Plugin 4.1.+ and Gradle 6.5.+.
In order to downgrade, just go to File -> Project Structure.
Had same issue. Moving project files to ntfs drive fixed it.
Downgrading the Android Gradle Plugin version from 4.1.0 to 4.0.2 and the Gradle version from 6.5 to 6.4.1 now it is working; works for me as well. Now app is no longer experiencing building errors.Thanks.
Error message was :
A problem was found with the configuration of task ':app:processDebugManifest' (type 'ProcessMultiApkApplicationManifest').
File 'F:\NietsPastApp\app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml' specified for property 'mainMergedManifest' does not exist.
Thanks for help, downgrade it's ok. just for other who search the file :
gradle 4.0.2 change here : /build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
gradle 6.4.1 : gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
File -> Project Structure. reduce your build tools version to 29
i tried it's work
In my case and for kotlin I have downgraded kotlin version from 1.4.32 to 1.4.31

Android build improper gradle version

I am trying to build an android project from the command line.
I am following this tutorial
My project structure and files match the tutorial exactly.
When I run gradle build it tells me that version 2.2 of gradle is required, but I have a newer version of gradle installed, 2.10. So does that mean I must download an older version of gradle to build android?
* What went wrong:
A problem occurred evaluating root project 'GradleJavaApp'.
> Failed to apply plugin [id 'com.android.application']
> Gradle version 2.2 is required. Current version is 2.10. If using the gradle wrapper, try editing the distributionUrl in H:\GradleJavaApp\gradle\wrapper\gradle-wrapper.properties to gradle-2.2-all.zip
Don't use older version of Gradle! Stick to version 2.10 (or newer).
If you followed the tutorial thoroughly,
you probably used version 1.1.3 of Android build plugin:
buildscript {
…
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
}
}
Build plugin version 1.1.3 is terribly outdated from the view of Android development (released on March 2015 according to the release notes).
Change that to the latest version 2.1.0.
Gradle wrapper should then stop complaining about Gradle version and
you should be able to use Gradle 2.10 normally.
Also replace all mentions of Gradle 2.3 in the tutorial with version 2.10.

Android Studio Gradle version - Gradle version 2.8 is required

I'm trying to build an Android project but the following error occurred
Error:(10, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Gradle version 2.8 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in C:\Users\...\gradle\wrapper\gradle-wrapper.properties to gradle-2.8-all.zip
It seem something's wrong with the Gradle version, however I checked the gradle-wrapper-property and it's already 2.10.
Also in File-Project Structure-Project, gradle-version is also 2.10
No idea how this happened, I've also restarted android-studio many times.
For those that still need help, an answer on another post did it for me link.
You need to change Settings > Builds,Execution,Deployment > Build Tools > Gradle >Gradle home path
Or set Use default gradle wrapper and edit Project\gradle\wrapper\gradle-wrapper.properties files field distributionUrl like this
distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip
I don't think that changing Gradle tools to version 1.5.0 is necessary, but if you're using 2.0-snapshot or beta version of gradle, I recommend you to change it to 1.5.0.
This error:
Error:(10, 1) A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Gradle version 2.8 is required. Current version is 2.4. If using the gradle wrapper, try editing the distributionUrl in
C:\Users...\gradle\wrapper\gradle-wrapper.properties to
gradle-2.8-all.zip
only tells you that your project's Gradle system is a bit outdated and need to be updated to newer version.
Open your project Android Studio and in navigator on the left find file called gradle-wrapper.properties. It should have a content like this:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
Change the last line with distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
It should work.
Go To Android Preference and Just change Project level Settings to Use default gradle wrapper (recommended).
There is a bug in version checking in older android plugins. To fix this you can either go back to gradle 2.9 or use the newer plugin
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
But I see from your error message that it tries to run with gradle 2.4 so this is maybe another problem.
Updating the version of android studio from 1.4 to 1.5.1 fixed this problem for me.

Failed to refresh Gradle project

I am using android studio 0.4.2 and I am facing the problem..
Here is the error.
Failed to refresh Gradle project 'epilepticapp'
You are using Gradle version 1.10, which is not supported. Please use version 1.9.
Please point to a supported Gradle version in the project's Gradle settings or in the
project's Gradle wrapper (if applicable.)

Categories

Resources