重命名项目后,我的React Native项目无法构建

时间:2019-09-02 06:47:45

标签: react-native react-native-android

我尝试重命名我的应用程序,因为我需要它,但是重命名后出现了问题(在重命名之前可以正常使用)。我遵循了以下说明:https://dev.to/abdulbasit313/proper-way-to-rename-a-react-native-project-in-2019-3b98,但是当我运行时,构建失败

我正在使用本机0.59.9

这是错误:

info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
> Task :app:preDebugBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.github.yalantis:ucrop:2.2.2-native.
     Searched in the following locations:
       - file:/C:/Users/ASUS/.m2/repository/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - file:/C:/Users/ASUS/.m2/repository/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
       - https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
       - https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
       - file:/D:/DISKOMINFO/3-SIMASA/simasamobile/node_modules/react-native/android/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.pom
       - file:/D:/DISKOMINFO/3-SIMASA/simasamobile/node_modules/react-native/android/com/github/yalantis/ucrop/2.2.2-native/ucrop-2.2.2-native.jar
     Required by:
         project :app > project :react-native-image-crop-picker

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 7s
21 actionable tasks: 20 executed, 1 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.

2 个答案:

答案 0 :(得分:1)

上述解决方案是不正确的,因为它会清除链接的库...您可以通过将name中的/android/src/main/res/values/strings.xml更改为所需的名称来轻松重命名android项目。同样在iOS上,您可以通过在Xcode中打开/ios/your_project.xcodeproj来更改名称,并在项目设置的Display Name标签中修改General

答案 1 :(得分:1)

请重新安装并重新链接库。这样可以解决问题。

react-native-image-crop-picker

也请参考here,以更轻松的方式重命名项目。