尝试为React-Native Android项目启动logKitty时出错

Pue*_*rto 5 android android-studio react-native

我已经在其他项目中运行了该记录器,但没有问题运行,react-native log-android为什么该项目文件夹中的记录器失败。这些大多数都是开箱即用的react-native init NewProjects,几乎没有更改。因此令我惊讶的是我无法运行记录器。我更喜欢cmd记录器。它比运行chrome浏览器更快。

? react-native log-android
info Starting logkitty
The filename, directory name, or volume label syntax is incorrect.
error Command failed: 'C:\Users\{UserPIN}\AppData\Local\Android\Sdk/platform-tools/adb' logcat -c
The filename, directory name, or volume label syntax is incorrect.
. Run CLI with --verbose flag for more details.
Error: Command failed: 'C:\Users\{UserPIN}\AppData\Local\Android\Sdk/platform-tools/adb' logcat -c
The filename, directory name, or volume label syntax is incorrect.

    at spawnLogcatProcess (c:\ws\mobile2\ReactRegLoc\node_modules\logkitty\build\android\adb.js:36:11)
    at runAndroidLoggingProcess (c:\ws\mobile2\ReactRegLoc\node_modules\logkitty\build\android\adb.js:21:10)
    at logkitty (c:\ws\mobile2\ReactRegLoc\node_modules\logkitty\build\api.js:137:85)    at Object.logAndroid [as func] (c:\ws\mobile2\ReactRegLoc\node_modules\@react-native-community\cli-platform-android\build\commands\logAndroid\index.js:37:44)
    at Command.handleAction (c:\ws\mobile2\ReactRegLoc\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:160:21)
    at Command.listener (c:\ws\mobile2\ReactRegLoc\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:189:13)
    at Command.parseArgs (c:\ws\mobile2\ReactRegLoc\node_modules\commander\index.js:651:12)
    at Command.parse (c:\ws\mobile2\ReactRegLoc\node_modules\commander\index.js:474:21)
    at setupAndRun (c:\ws\mobile2\ReactRegLoc\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:210:24)
Run Code Online (Sandbox Code Playgroud)

Rei*_*eid 6

目前看来,它已经坏了,但是一个临时性的解决方法是更改​​node-modules文件夹中的文件。

在node_modules / logkitty / build / android / adb.js中

将第29行更改为:

return process.env.ANDROID_HOME ? `${process.env.ANDROID_HOME}\\platform-tools\\adb` : 'adb';
Run Code Online (Sandbox Code Playgroud)

并将第34行更改为:

(0, _child_process.execSync)(`${adbPath} logcat -c`);
Run Code Online (Sandbox Code Playgroud)