android - npx react-native run-android 不起作用 - "java.io.IOException: The filename, directory name, or volume label syntax is incorrect"

标签 android react-native gradle

就在最近推出的世博会,我正在尝试在 Android 设备上运行我的应用程序。我按照说明操作(希望是正确的),但是当我尝试运行我的应用程序时,我不断收到此错误:

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

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> 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 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> 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 3s

    at makeError (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\execa\index.js:174:9)
    at C:\Users\User\Documents\jad for eject\jad\jad\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async runOnAllDevices (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
    at async Command.handleAction (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\@react-native-community\cli\build\index.js:186:9)

谢谢您的帮助!

最佳答案

我在 Windows 上遇到了同样的问题,我的问题是 Gradle local.properties文件。
它包含以下内容:

org.gradle.java.home=C:\Program Files\Java\jdk-15.0.1
sdk.dir=C:\Users\user\AppData\Local\Android\Sdk
问题可能是 Windows 反斜杠 ( \ )。有效的是逃避它:
org.gradle.java.home="C:\\Program Files\\Java\\jdk-15.0.1"
sdk.dir=C:\\Users\\user\\AppData\\Local\\Android\\Sdk

关于android - npx react-native run-android 不起作用 - "java.io.IOException: The filename, directory name, or volume label syntax is incorrect",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62263528/

相关文章:

android - 非法状态异常 : Fragment already added - during app startup on Android OS 4. 3

android - ButterKnife 内部 fragment 和工具栏高度

android - ViewPagerIndicator 在 setCurrentItem() 之后没有更新

java - Gradle 。如何从另一个模块复制资源

android-studio - 错误 :Execution failed for task ':app:transformClassesWithMultidexlistForDebug' . > java.lang.UnsupportedOperationException(无错误信息)

android - 错误 :Could not read cache value from '/Users/gsp/.gradle/daemon/2.10/registry.bin'

typescript - 平台特定的导入组件与 typescript native react

react-native - 从选项卡导航器屏幕导航到堆栈导航器屏幕时,我无法在 react-native 中使用 react-navigation 传递参数

react-native - 使用可变项目大小滚动到 FlatList 中某个索引的有效方法

android - 无法使用 gradle 安装执行构建