【发布时间】:2020-05-16 10:47:21
【问题描述】:
我正在尝试对我的真实 Android 设备运行本机应用程序。 我在运行前检查了我的设备
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
什么都不显示..
在堆栈跟踪的底部我也看到了这个错误
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 时它正在工作。 我的问题是什么?
反应原生:0.61.5
奇怪的是它在计算机启动后首次执行。然后我尝试重新连接手机,它再次弹出。
【问题讨论】:
标签: android react-native gradle build.gradle