运行React Native原生项目出现错误:配置项目':react-native-reanimated'时发生问题。

12
我已经通过 Expo 工具包安装了 React Native,现在当我运行 yarn run android 时收到了错误提示。我的模板没有做任何更改。我不知道发生了什么。如果需要进一步的信息,请随时询问。我还检查了 React Native Reanimated 的 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

1
不仅是这个库的问题,我已经移除了它,现在错误出现在react-native屏幕中。 - Deyvid Popov
1
遇到了同样的问题,有解决方案吗? - Swift
4个回答

5

您需要安装Android API 29并重新打开项目,然后它就会自动修复。

只需从Android Studio中的SDK管理器中进入,并安装Android 10.0(Q)级别29,显示软件包详细信息:Google APIs Intelx86原子系统镜像

然后重启Android Studio并打开项目,它就可以正常工作了...图像


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
        }
}

0
在我的情况下,在Windows上,是local.properties文件中错误的Android SDK路径。需要双反斜杠。

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接