运行react native裸项目导致错误配置项目':react-native-reanimated'时发生问题

时间:2020-04-18 08:15:11

标签: javascript java android react-native

我已经通过expo工具包安装了native本机,现在当我运行yarn run android时,我收到了该错误。我没有更改模板上的任何内容。我不知道发生了什么。如果还有其他问题,请随时询问。我还检查了react native的build.gradle,但不幸的是,没有成功。

FAILURE: Build failed with an exception. 

* Where:
Build file 'C:\Users\David\Desktop\TheGuruApp\node_modules\react-native-reanimated\android\build.gradle' line: 89

* What went wrong:
A problem occurred configuring project ':react-native-reanimated'.
> java.io.IOException: The filename, directory name, or volume label syntax is incorrect

* 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

BUILD FAILED in 28s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\David\Desktop\TheGuruApp\node_modules\react-native-reanimated\android\build.gradle' line: 89

* What went wrong:
A problem occurred configuring project ':react-native-reanimated'.
> java.io.IOException: The filename, directory name, or volume label syntax is incorrect

* 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

BUILD FAILED in 28s

3 个答案:

答案 0 :(得分:2)

您已安装 Android API 级别 29 并重新打开项目...然后它会自行修复。

只需从 android studio 转到 sdk manager 并安装 android 10.0(Q) level 29,显示软件包详细信息 google apis intelx86 Atom 系统映像

并重新启动android studio并打开它将工作的项目... image

答案 1 :(得分:0)

您需要设置开发环境以进行本机响应。使用以下链接

https://reactnative.dev/docs/environment-setup

还请检查其jdk版本应高于或等于11.0

答案 2 :(得分:0)

下面提到的 build.gradle (node_modules\react-native-reanimated\android\build.gradle) 中的代码有问题:

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider.get()) {
            from variant.javaCompileProvider.get().destinationDir
        }
}

如果用下面提到的代码替换它,上述问题就解决了。

android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
            from variant.javaCompile.destinationDir
        }
}