react-native: Android build failed: 'Failed to list versions for com.facebook.react:react-native.'
Description
- What went wrong: Could not determine the dependencies of task ‘:app:compileDebugKotlin’.
Could not resolve all files for configuration ‘:app:debugRuntimeClasspath’. Could not resolve com.facebook.react:react-native:+. Required by: project :app project :app > project :react-native-push-notification project :app > project :react-native-code-push project :app > project :react-native-async-storage_async-storage project :app > project :react-native-community_blur project :app > project :react-native-community_clipboard project :app > project :react-native-community_datetimepicker project :app > project :react-native-community_masked-view project :app > project :react-native-community_netinfo project :app > project :react-native-community_picker project :app > project :react-native-firebase_analytics project :app > project :react-native-firebase_app project :app > project :react-native-firebase_crashlytics project :app > project :sumsub_react-native-mobilesdk-module project :app > project :react-native-action-sheet project :app > project :react-native-appsflyer project :app > project :react-native-camera project :app > project :react-native-config project :app > project :react-native-device-info project :app > project :react-native-fbsdk-next project :app > project :react-native-file-viewer project :app > project :react-native-fs project :app > project :react-native-geolocation-service project :app > project :react-native-gesture-handler project :app > project :react-native-get-random-values project :app > project :react-native-haptic-feedback project :app > project :react-native-idfa project :app > project :react-native-image-crop-picker project :app > project :react-native-image-picker project :app > project :react-native-maps project :app > project :react-native-permissions project :app > project :react-native-safe-area-context project :app > project :react-native-screens project :app > project :react-native-set-soft-input-mode project :app > project :react-native-share project :app > project :react-native-shared-element project :app > project :react-native-sms-retriever project :app > project :react-native-splash-screen project :app > project :react-native-svg project :app > project :react-native-text-input-mask project :app > project :react-native-vector-icons project :app > project :react-native-version-number project :app > project :react-native-webview project :app > project :react-native-yamap Failed to list versions for com.facebook.react:react-native. Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml. Could not HEAD ‘https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml’. Read timed out
Version
0.65.1
Output of npx react-native info
System: OS: macOS 13.0 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Memory: 55.72 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node Yarn: 3.1.1 - /usr/local/bin/yarn npm: 8.16.0 - ~/WebstormProjects/mono-front/node_modules/.bin/npm Watchman: 2022.08.15.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/magdaaa/.rvm/gems/ruby-2.7.4/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild Languages: Java: 11.0.16 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.65.1 => 0.65.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
start to build android app
- react-native run-android
Snack, code example, screenshot, or link to a repository
build.gradle
dependencies { … implementation “com.facebook.react:react-native:+” … }
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 96
- Comments: 273 (6 by maintainers)
JCenter and Bintray shut down today.
android/build.gradle
before rebuild run:
Hey everyone,
I tweaked a few things in my
build.gradle
file to emulate what thisbuild.gradle
looks like and my build errors went awayremove
jcenter
references and usemavenCentral
Hope this fixes everyone 😃
Raise funds to buy jcenter.
Switch off the internet when building the package works for me. I think that’s just a temporary solution. But at least it worked!
gradlePluginPortal()
It’s works.
Finally after hours of head bangs, issue resolved. No need to edit node_modules. In android/build.gradle add the following at the top in all projects -> repositories It should look something like this
What it does: It will remove jcenter() from all the projects during config phase and replace it with mavenCentral() Viola 🥳
It may be stupid but work for me it is replace all jcenter() in your project even node_module by mavenCentral()
Its works
I added ArtifactRepository repo line and I changed mavenCentral() instead of jCenter() and solved from my side
@kurisu994
https://bintray.com/ says 410 gone and https://jcenter.bintray.com/ says 403 forbidden
edit: to those who are confused
Could you guys try this and check if it works (in case you still using some library on jcenter)? So it seems not all jcenter repo down
disconnect from internet and build
As the Gradle is down , I guess the best solution will be to switch your internet off and run the app it worked for me !
replacing jcenter() to mavenCentral() works.
Some resume.
There are several options you can try:
jcenter()
withmavenCentral()
- if you have no any 3d-party dependencies withjcenter()
jcenter()
withmavenCentral()
and update 3d-party dependencies to the versions wherejcenter()
not usedjcenter()
withgradlePluginPortal()
- If you can’t fast update 3d-party dependencies at the moment (see here)Before trying this clean
node_modules
and execute./gradlew clean
403 forbidden 😦 we’ll wait and see…
https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml
Disconnect your internet and then build your app, its working
I get a similar error with an expo managed rn app:
Temporary solution: Most of the packages use
jcenter()
and mavenCentral() both. You need to replace jcenter() bygradlePluginPortal()
from thebuild.gradle
file of the packages that you have used in your project in order to run it. To do so, selectjcenter()
fromandroid>build.gradle
and pressCommand + Shift + F
as shown in the imageYou can skip the README.md, jarRepositories.xml and CHANGELOG.md files
as i said i have tried all the possible ways but still not fixed it.
it works for me
Incident resolved
https://status.gradle.com
JCenter works well right now and builds successfully completed with my default configs. (not removing JCenter or replacing with gradlePluginPortal etc). FYI
@SHMay100G
JCenter works now. But you never know when jcenter will die again. We must deal with this situation.
It’s work for me. 😁
@mowaisch no, dont remove that. so mine is something like this on root/build.gradle --> allProject{}:
Has been restored. JCenter works now.
@ahmdshrif brother i cannot eject i need to publish my app ASAP, my most of the dependencies are based on expo and my project contains more than 150 dependencies.
replacing jcenter() by gradlePluginPortal() works for me , but i thinks it’s just a temporary solution .
still have issue
android -> build.gradle
This worked for me, thank you.
Same! No libs were changed either 😕
I replaced the jcenter() with mavenCentral() and it still doesn’t work for me. Does anyone have any solution please?
gradlePluginPortal() mavenCentral() replace jcenter with above
replacing jcenter to mavenCentral causes another error
`Could not determine the dependencies of task ‘:app:mergeDebugAssets’.
I was able to fix my build. Apparently jcenter is down. It was already deprecated for some time now. I am not sure if it is finally down forever now or if this is temporary.
I had to update all dependencies that still used jcenter to the newest version. Most of them replaced jcenter with maven already. One I had to manually patch with https://github.com/ds300/patch-package myself.
After that my build worked again.
In android/build.gradle
This is worked for me after trying a lot of things that were commented on here !!! Thanx
Hello,
Same problem, in my case I can’t replace
jcenter
withmavenCentral
because I need it for some old libraries.JCenter is deprecated
UPDATE
I am going to tell you how to solve the problem, not only is it enough to replace jcenter with maven in the build.gradle of the application, this must also be done in the build.gradel of each package within node_modules, you have several ways to do it for example creating forks of those libraries or use the script above from @Orange9000
"replace": "cd node_modules && grep -ilr 'jcenter()' * | xargs -I@ sed -i '' 's/jcenter()/mavenCentral()/g' @",
This script should be run after yarn install and it will replace everything in jcenter with maven, this takes a few minutes.
However, I have followed all the methods mentioned above. Until able to solve the problem for the application to run, but it still has many bugs, such as the keyboard of the input shows. And quickly shut down and unable to build apps as releases (.APK and .AAB). Hope there is a better solution.
I confirm that for 0.64.2
gradlePluginPortal()
replacingjcenter()
works, but the build is extremely slow. So consider it as temporary work around!Gradle is down https://status.gradle.com/
This worked for me. But we need a proper solution.
@a554878526 @orchsik
jcenter has shutdown in the last 24 hours I think.
You should
grep "jcenter"
and see which modules in your project contain references to it still. Upgrade those packages, if they have fixed it in a new release, or replacejcenter
withmavenCentral
in the package files yourself and usepatch-package
to maintain the changeI’ve just finished doing this and found many packages actually fixed this and just required an update to the version of those packages.
GL ✌️
@stephanrotolante can you help me share your complete build.gradle ?. because i already remove jcenter but still got error. Thanks
@shivamIqlance JCenter is deprecated
https://developer.android.com/studio/build/jcenter-migration
What work for me in android/build.gradle i remove
jcenter()
and addmavenCentral()
andmaven { url 'https://maven.testfairy.com' }
to be like this and in app/build.gradle i addimplementation 'com.testfairy:testfairy-android-sdk:1.+@aar'
after that if you still get the error you will get it in a specific library you can try to remove and install the last one i got in react-native-video i just removed it and install it again and it’s work for meThis seems to be the best solution and it workerd for me.
Inside the
android/build.gradle
file, I have replace thejcenter()
withgradlePluginPortal()
and it’s working for me.Replace jcenter() with mavenCentral( ) & gradlePluginPortal( ) in
android/build.gradle
, it works@mauricedoepke The same problem exists with Expo 43.0. Can you tell me the details or commands?
this solution work for me thanks
doesn’t seem to, 403 :https://jcenter.bintray.com/
also happen to me! and replacing jcenter() to mavenCentral() not work for me !!!
From what I’ve understood, If you haven’t cleaned your project recently, you can switch off the internet and it will build just fine.
But if you wanted to create a release build/test apk and you’ve cleaned beforehand, you’ll need jcenter to work if you have dependencies that exist on jCenter, but not on maven.
In my case I’ve migrated from 0.60.5 fo 0.66.4 a long time ago, but I hadn’t fully upgraded the packages to be supported by maven. So I hadn’t deleted jcenter().
This is what happened before removing jCenter().
…Could not determine the dependencies of task ‘:app:lintVitalRelease’.
After removing jCenter():
So I had to find replacements for the listed dependencies from maven, and the errors disappeared one by one. I have 25+ dependencies though… I hope they fix this soon…
this answer worked for me, https://github.com/facebook/react-native/issues/32734#issuecomment-1013431238
I’m having the same problem
You’re not alone, experiencing same error
BUILD FAILED in 1m 47s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
Steps to reproduce are the same.
this is fix my problem try it https://stackoverflow.com/questions/74333132/task-react-native-async-storage-async-storagegeneratedebugrfile-failed
is jcenter down again?
gradlePluginPortal()
worked for meYes I also had success w/ this, but I consider it a bandaid until the community can align on a more permanent fix.
check above solutions
For me this changes were needed to solve it:
google()
to topjcenter()
withgradlePluginPortal()
Simple
package.json
script to replace every occurrence ofjcenter()
in yournode_modules
. No patching required, works on MacOS. Runyarn replace
command in a console.https://stackoverflow.com/questions/74258160/is-jcenter-down-permanently-31-oct
Above both solution works for me this script also remove jcenter from transitive dependencies
JCenter downtime impact on resolutionSubscribe Identified - While the mirroring put in place alleviates some of the JCenter being down impact, the mirror is a bit out of date and currently cannot sync recent artifacts. This continues to impact builds. Oct 31, 2022 - 09:56 UTC
Let’s wait out a bit.
I can able to run now thank you
tried
./gradlew clean
and commentedjcenter()
still have issue…Most of our apps are old versions of npm. There are too many jcenter dependencies that can be changed at once. Is there any other way besides updating the npm?
I had to comment out the
jcenter()
commands inbuild.gradle
. If it is required by any of your libraries, you would need to check if there is a newer version of the library, which does not need it.Obviously, you will need to delete the following folders (if any of them exists) before trying to rebuild your app.
android/.grdale
,android/.idea
,android/build
&android/app/build
This is a duplicate of #35210
Nope
Check this issue https://github.com/facebook/react-native/issues/35210 hope this help
Facing new error now…
Execution failed for task ‘:react-native-community_datetimepicker:compileDebugJavaWithJavac’.
Facing new error now…
D:\Projects\MobileApp\poimobileapp\node_modules@react-native-community\datetimepicker\android\src\main\java\com\reactcommunity\rndatetimepicker\Common.java:57: error: lambda expressions are not supported in -source 7 return presentedDialog -> { ^ (use -source 8 or higher to enable lambda expressions) 1 error
FAILURE: Build failed with an exception.
It work for now. Can be build normal 🚀🚀🚀🚀🚀🚀
Does anyone know why?
@eesttiwar check this out fixed this at morning today
I was able to build my project in
release
mode with this fixAdding this in
android/build.gradle
(like most of the answers here)Additionally, Had to add this in
android/app/build.gradle
I don’t know how dangerous is the
lintOptions
- but it worked for me.Good luck!
✅ This works for me. Worth to try 👍
VS CODE SETTING
START SEARCHING
Search all
jcenter()
inside the project folder including in node_modulesREPLACE ALL OF THEM
Replace
jcenter()
withmavenCentral()
START BUILDING
Try if it works by
yarn android
INSTALL
patch-package
If that works, now use
patch-package
library (https://www.npmjs.com/package/patch-package) so the patches will be applied back after you or your teammate need to doyarn install
(reinstalling node_modules).START PATCHING LIBRARIES
Patch your modified libraries using (I’m using yarn):
yarn patch-package <your_library_name>
COMMIT THE CHANGES
Add and commit your modified files, including <your_library_name+x.x.x>.patch patch file into your repository.
Hope this helps!
I am not using expo
Thanks, this worked for me.
Can you share full screen screenshot?
This solved most of my issues. The only other thing I had to do was update a few dep’s versions which were somehow different between JCenter and Maven. For example, I was using version 1.8.1 of a dep and Maven only had 1.8.0 and 1.9.0 so I switched to 1.9.0.
check above solutions
it works to me
I adding in allprojects > repositories and worked for me
gradlePluginPortal()
maven { url "https://maven.aliyun.com/repository/jcenter" }
Good morning, I have no reference to jcenter in my gradle file, I can validate that everything there is maven, but I am having the same problem.
Does anybody want to share an expo config plugin for that?..
https://status.gradle.com
worked for me
I succeeded to build app with this solution 👍
@farooqalam20996 you need to put them in the first row。
Tried but not working
Those who’s still having issues, go to build.gradle , see if you have
jcenter()
in the file, comment or remove this line.This works
With all the url in, it worked. This was a good solution for me. Thank you.
This worked. Thank you so much!
This worked for me. Thank You !!
I Solved the Issue with these things.
Delete Nodemodules and .gradle folder
Replace jcenter() with gradlePluginPortal() in build.gradle file.
Hi my friends,
I tried with this solution and it worked for me. You can refer this:
Hope you all can resolve your issue
Still not working for me
worked for me replacing jcenter() to mavenCentral()
Worked for me as well 👍🏻
Hello,
I am still facing the same issue when building new release app, works pretty well with debug app Looking for an update really soon.
Thanks!
@nyomanyudis95 try running a gradle clean, then rebuild
}
@olcaneristi Probably going to have to change where were fetching these deps from in the build process because JCenter and Bintray aren’t working.
@louniss I can’t find any resources that state JCenter and Bintray being shutdown today? I found something that mentions being shutdown Feb 1st 2022, but were now way past that date