Sus*_*ani 6 android react-native visual-studio-code react-native-android
我已经创建了一个react-native
应用程序VS Code
并尝试在设置配置后运行它launch.json
"version": "0.2.0",
"configurations": [
{
"name": "Debug Android",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "android",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
}
]
Run Code Online (Sandbox Code Playgroud)
我已将设备连接到 PC,在设置配置后,我按了 F5,但 IDE 抛出错误说
Error while executing command 'react-native.cmd run-android --no-packager' (error code 101)
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个问题。如果您需要有关该问题的更多详细信息,请告诉我。
出现此错误的原因有多种。最常见的原因之一是您所连接的设备失去了连接。因此,检查调试设备是否仍处于连接状态非常重要。
为此,您可以使用以下命令:
$ adb devices
Run Code Online (Sandbox Code Playgroud)
确保您的设备仍处于连接状态并且可见。如果不是这种情况,请拔下并重新插入您的设备。
如果这仍然没有帮助,您可以按照此处答案中提到的一些附加步骤操作:how-to-fix-error-device-not-found-with-adb-exe
如果您的设备已连接,并且此错误仍然发生。在 vscode 中启动终端窗口并react-native run-android --no-packager
直接运行命令。
在这里您很可能会看到诸如出现之类的错误Error: Command failed: gradlew.bat installDebug
。现在慢慢向上滚动,直到到达*where
和 ,*what
其中应该包含有关实际问题的更多详细信息。
示例如下:
* Where:
Build file 'D:\micomputapath\android\app\build.gradle' line: 80
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not read script 'D:\micomputapath\node_modules\react-native-sentry\sentry.gradle' as it does not exist.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6353 次 |
最近记录: |