7

I am trying to run react native app to my real android device. I checked my device before running

adb devices

List of devices attached
3357425441473098        device

I started with

npx react-native start

and in other console

npx react-native run-android

But got an error..

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      

And right after that error. I lost my device connection.

adb devices

shows nothing..

and at the bottom of stacktrace I see this error also

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: Build failed with an exception.

* 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)

My device is us samsumg galaxy s9. It was working when I use Expo sdk. What is my problem?

react-native : 0.61.5

Weird thing is that it works first execution after computer boot. then I tried reconnect phone, and it pops up again.

9 Answers 9

10

I had a similar issue. I noticed that the USB configuration defaults back to No data transfer every time I connect it with an USB-cable. It even seems to happen sometimes when the cable is still connected.

You can change the default USB configuration in the developer settings:

Go to Developer Options > Default USB configuration > and change the setting to File Transfer / Android auto

Sign up to request clarification or add additional context in comments.

Comments

3

Just had the same problem. Turned out it was an issue with my USB cable. For some reason the installation process was being interrupted half way through by the device going offline. I've replaced the cable, and everything started working again.

1 Comment

I also had the same problem and fixed it by using one of the MacBook's USB-C ports. Before, it was presenting the error when my phone was plugged into a docking station connected to my PC.
2

I had this, then spent two hours trying this:

Change USB cable (FAIL) Upgrade Android Studio (FAIL) Try a different android device (FAIL) Reboot device (FAIL) Reboot laptop (FAIL) Try via command line ADB (FAIL) ADB Kill-server (FAIL)

then I found this post

saying to uncheck the Android studio libusb backend option here

that's when I remembered turning that option on yesterday for something else :-(

Comments

1

I had same problem. I used another port in my laptop and it is working well.

Comments

1

Many times you encounter this error when your device lacks sufficient space. Please check the available space on your device.

Comments

1

Most times this stack trace occurs when your device is low on storage or sufficient space. Free up some space and try again.

Comments

0

In my case, I turned the developer mode off and USB debugging off also. Then I turned both of them on but after that It was throwing error again then I changed my cable and its working fine now :)

Comments

0

I have this issue currently too.

At first, if I unplugged the device and then ran adb kill-server and adb start-server it would always fix it. Then that stopped working and would only work 1/10 times.

Then, I noticed that it went away for a few days when I switched to a new cable. Now it's back though! Very frustrating.

Just now, I tried turning off USB debugging and turning it back on. And then revoking the USB debugging authorization and re-granting after plugging back into the computer. On the next try, I was able to launch my app. But I don't think this is actually the solution.

Still no idea what the deterministic fix is for this.

Comments

0

Mine was happening because my phone was on Charge only mode. I change it to Transfer files mode. Depending on your device, one can either have on of these three modes

  1. Charge only
  2. Transfer files / Android Auto
  3. Transfer photos

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.