安装react-native-router-flux后出现错误

问题描述

我创建了一个新的无反应原生项目 在安装react-native-router-flux和react-native install react-native-router-flux并运行react-native run-android之后,我看到了这个错误,项目没有运行。

enter image description here

我的原始错误

失败:构建失败,并出现异常。

  • 出了什么问题: 无法确定任务':app:mergeDebugAssets'的依赖关系。
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not find androidx.transition:transition:1.1.0.
     Searched in the following locations:
       - file:/C:/Users/Sina/.m2/repository/androidx/transition/transition/1.1.0/transition-1.1.0.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/react-native/android/androidx/transition/transition/1.1.0/transition-1.1.0.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/jsc-android/dist/androidx/transition/transition/1.1.0/transition-1.1.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/transition/transition/1.1.0/transition-1.1.0.pom
       - https://jcenter.bintray.com/androidx/transition/transition/1.1.0/transition-1.1.0.pom
       - https://www.jitpack.io/androidx/transition/transition/1.1.0/transition-1.1.0.pom
     required by:
         project :app > project :react-native-reanimated
Could not find androidx.fragment:fragment:1.2.1.
     Searched in the following locations:
       - file:/C:/Users/Sina/.m2/repository/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/react-native/android/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/jsc-android/dist/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - https://jcenter.bintray.com/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - https://www.jitpack.io/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
     required by:
         project :app > project :react-native-screens
Could not find androidx.coordinatorlayout:coordinatorlayout:1.1.0.
     Searched in the following locations:
       - file:/C:/Users/Sina/.m2/repository/androidx/coordinatorlayout/coordinatorlayout/1.1.0/coordinatorlayout-1.1.0.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/react-native/android/androidx/coordinatorlayout/coordinatorlayout/1.1.0/coordinatorlayout-1.1.0.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/jsc-android/dist/androidx/coordinatorlayout/coordinatorlayout/1.1.0/coordinatorlayout-1.1.0.pom
       - https://dl.google.com/dl/android/maven2/androidx/coordinatorlayout/coordinatorlayout/1.1.0/coordinatorlayout-1.1.0.pom
       - https://jcenter.bintray.com/androidx/coordinatorlayout/coordinatorlayout/1.1.0/coordinatorlayout-1.1.0.pom
       - https://www.jitpack.io/androidx/coordinatorlayout/coordinatorlayout/1.1.0/coordinatorlayout-1.1.0.pom
     required by:
         project :app > project :react-native-screens
Could not find com.google.android.material:material:1.1.0.
     Searched in the following locations:
       - file:/C:/Users/Sina/.m2/repository/com/google/android/material/material/1.1.0/material-1.1.0.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/react-native/android/com/google/android/material/material/1.1.0/material-1.1.0.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/jsc-android/dist/com/google/android/material/material/1.1.0/material-1.1.0.pom
       - https://dl.google.com/dl/android/maven2/com/google/android/material/material/1.1.0/material-1.1.0.pom
       - https://jcenter.bintray.com/com/google/android/material/material/1.1.0/material-1.1.0.pom
       - https://www.jitpack.io/com/google/android/material/material/1.1.0/material-1.1.0.pom
     required by:
         project :app > project :react-native-screens
Could not find androidx.fragment:fragment:1.2.1.
     Searched in the following locations:
       - file:/C:/Users/Sina/.m2/repository/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/react-native/android/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - file:/C:/Users/Sina/Desktop/HermesLock3/node_modules/jsc-android/dist/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - https://dl.google.com/dl/android/maven2/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - https://jcenter.bintray.com/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
       - https://www.jitpack.io/androidx/fragment/fragment/1.2.1/fragment-1.2.1.pom
     required by:
         project :app > com.facebook.flipper:flipper:0.37.0 > androidx.appcompat:appcompat:1.1.0

在3m 43s内失败

错误无法安装该应用程序。确保已设置Android开发环境:https://reactnative.dev/docs/environment-setup。使用--verbose标志运行CLI以获取更多详细信息。 Error: Command Failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

解决方法

如果您来自受到制裁的国家/地区,最好使用代理并重试。