我正在尝试对我的真实 android 设备运行 native 应用程序。
我在运行前检查了我的设备
adb devices
List of devices attached
3357425441473098 device
我从
npx react-native start
在其他控制台中
npx react-native run-android
但是报错了。。
Task :app:installDebug FAILED
10:25:40 V/ddms: execute: running am get-config
10:25:40 V/ddms: execute 'am get-config' on '3357425441473098' : EOF hit. Read: -1
10:25:40 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'SM-G960U - 9' for app:debug
10:25:40 D/app-debug.apk: Uploading app-debug.apk onto device '3357425441473098'
10:25:40 D/Device: Uploading file onto device '3357425441473098'
10:25:40 D/ddms: Reading file permision of /home/user/react-native/awesomeProject/android/app/build/outputs/apk/debug/app-debug.apk as: rw-rw-r--
10:25:40 D/ddms: read: channel EOF
10:25:40 E/Device: Error during Sync: EOF
Unable to install /home/user/react-native/awesomeProject/android/app/build/outputs/apk/debug/app-debug.apk
com.android.ddmlib.InstallException: EOF
就在那个错误之后。我失去了设备连接。
adb devices
什么都不显示。。
在stacktrace的底部我也看到了这个错误
Caused by: java.io.IOException: EOF
at com.android.ddmlib.AdbHelper.read(AdbHelper.java:862)
at com.android.ddmlib.SyncService.doPushFile(SyncService.java:712)
at com.android.ddmlib.SyncService.pushFile(SyncService.java:406)
at com.android.ddmlib.Device.syncPackageToDevice(Device.java:988)
at com.android.ddmlib.Device.installPackage(Device.java:902)
FAILURE:构建失败并出现异常。
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: EOF
* 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 10s
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (/home/user/react-native/newProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevice
s.js:94:39)
at buildAndRun (/home/user/react-native/newProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/user/react-native/newProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
我的设备是我们三星 Galaxy s9。当我使用 Expo sdk 时它正在工作。
我的问题是什么?
react 原生:0.61.5
奇怪的是它在计算机启动后首次执行。然后我尝试重新连接手机,它再次弹出。
最佳答案
刚遇到同样的问题。原来这是我的USB电缆的问题。由于某种原因,安装过程中途因设备脱机而中断。
我已经更换了电缆,一切又开始工作了。
关于android - npx react-native run-android : E/Device: Error during Sync: EOF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59992477/