0

I am developing a mobile app with using react-native on WebStorm and trying to test it via an Android emulator(Pixel API 28) which I created via using AVD Manager of Android Studio. The problem is when I run the react-native run-android command, I get the following error:

Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration             
':app:debugRuntimeClasspath'.
   > Could not resolve com.facebook.react:react-native:+.
     Required by:
         project :app
      > 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'.
               > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/35.158.228.205, jcenter.bintray.com/3.120.47.203] failed: Read timed out

I tried to clean up the cache with using the command below but it did not worked:

npm cache clean --force

I could not find some similar problems on the web and I am not sure what to show related with this problem.

When I try to run one of my previous project which was perfectly running, after getting this error and I saw that it also throws the same error. Similarly, when I create a new react-native project and try to run it, then I also got the same error. How can I solve this?


I am still loking for a solution. Anyone knows how to solve it?

JollyRoger
  • 737
  • 1
  • 12
  • 38
  • Open your app in Android Studio and sync project. Android Studio automatically download and installed dependencies for you. – Sham Gir Oct 25 '19 at 09:26
  • @ShamGir This is not an Android Studio project actually. I opened it with Android Studio, then try to create a run/debug config but at the module tab, it says "". So could not create a run/debug config. I read about how to sync project in Android Studio here (https://stackoverflow.com/questions/19932793/syncing-android-studio-project-with-gradle-files) but there is no Android tab under Tools menu of mine. So that does not worked for me. – JollyRoger Oct 25 '19 at 12:56
  • There is an sync option in **File** Tab. check it. **File -> sync project files with gradle files** – Sham Gir Oct 25 '19 at 13:26
  • @ShamGir The problem is occured again. I tried to sync it but did not worked. – JollyRoger Oct 26 '19 at 13:24

1 Answers1

0

I finally figured out the problem. I was connecting to internet via my school's network and it was restricting some downloads. So, that is why I got this error. For the ones who encountered with the same error, try to connect to the link in the error to if it is forbidden or not.

JollyRoger
  • 737
  • 1
  • 12
  • 38