Fork me on GitHub
Chris Swanson16:07:15

hi guys i'm still having trouble with this issue. it was working , and now seems to have stopped again. same symptom, hangs at installDebug with these messages:

➜  my-app react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...

> Task :app:installDebug
04:26:09 V/ddms: execute: running am get-config
04:26:09 V/ddms: execute 'am get-config' on 'HT68W0203272' : EOF hit. Read: -1
04:26:09 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Pixel XL - 9' for app:debug
04:26:09 D/app-debug.apk: Uploading app-debug.apk onto device 'HT68W0203272'
04:26:09 D/Device: Uploading file onto device 'HT68W0203272'
04:26:09 D/ddms: Reading file permision of /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk as: rw-rw-r--
<============-> 98% EXECUTING [57s]
> :app:installDebug 

Chris Swanson16:07:02

I know it can work , I saw everything running fine on the exact same device just this morning. and i confirmed again it runs on an emulator

Chris Swanson16:07:24

would really appreciate a hand, not sure where to go next. google hasn't really turned up anything helpful , i've done all the normal stuff of deleting watchman watches , increasing user limits, resetting metro cache , etc


Can you uninstall the app manually ?

Chris Swanson16:07:51

One interesting point is that after it hangs like this, adb gets messed up ("adb reverse --list" hangs)

Chris Swanson16:07:09

let me try to uninstall


The way it reads to me is: you have an app on the device and the newer version can’t be installed on top of it.

Chris Swanson16:07:15

interesting , shouldn't it be able to install over itself though? (i'm trying again, uninstalled the app)


The times this happened to me is because I installed the production release app, with a certificate and was trying to install unsigned app over it.

Chris Swanson16:07:38

interesting - maybe when i tried to run in from the android studio this could have happened ?


The key in that log above is Reading file permision of... if you get that, the solution for me has been the manual uninstall.


What was the app version on that device before? Was it also a debug release or production (as in, signed with a cert)?

Chris Swanson16:07:05

as far as i know it was debug, i never did anything to sign it - to be honest, i'm quite new new mobile dev

Chris Swanson16:07:28

seems like even after the uninstall , it stall hangs in the same way


What do logs say?

Chris Swanson16:07:37

i see figwheel log

Chris Swanson16:07:42

but it's not connected


Whatever the output is when you try to run the command that you try to run, like the one you posted above. You said that the install hangs. What output is there when it hangs?

Chris Swanson16:07:38

oh it looks like this:

➜  my-app react-native run-android
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

> Task :app:installDebug
04:37:53 V/ddms: execute: running am get-config
04:37:53 V/ddms: execute 'am get-config' on 'HT68W0203272' : EOF hit. Read: -1
04:37:53 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Pixel XL - 9' for app:debug
04:37:53 D/app-debug.apk: Uploading app-debug.apk onto device 'HT68W0203272'
04:37:53 D/Device: Uploading file onto device 'HT68W0203272'
04:37:53 D/ddms: Reading file permision of /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk as: rw-rw-r--
<============-> 98% EXECUTING [3m 37s]
> :app:installDebug


Not sure what it could be apart from the file permissions line above. So I had a look at the file permissions for the debug releases I have locally and the file permissions are: -rw-r--r-- be they debug or prod. Not sure if running chmod 644 /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk will help?


And then attempting to install it again, maybe this time directly via: adb -s HT68W0203272 install -r /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk?

Chris Swanson16:07:05

just the chmod didn't work , let me see about reinstall with adb


See if the device name is correct with adb devices -l first.


And when you say “didn’t work” what exactly was the error when it didn’t work?

Chris Swanson16:07:10

➜  my-app adb devices -l
List of devices attached
HT68W0203272           device usb:1-1 product:marlin model:Pixel_XL device:marlin transport_id:3

➜  my-app adb -s HT68W0203272  install -r /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk
Performing Streamed Install


OK, wait until your prompt returns or you get an error…

Chris Swanson16:07:43

after chmod i tried but it gave the same output, just hung on app:installDebug again

Chris Swanson16:07:04

ok, streamed install seems hung too , i'll wait till it times out


maybe the app is just large, see how big is it via du -s full-path-to-the-apk

Chris Swanson16:07:25

➜  my-app du -s /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk
32080   /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk


So that is ~32MB, which is not big.

Chris Swanson16:07:02

it should be really small, it's just the re-natal basic template. first time trying re-natal


Are you sure that the app on your device is really uninstalled ?

Chris Swanson16:07:25

let me double check

Chris Swanson16:07:33

yea it's definitely uninstall, but i noticed it's waiting for me to restart on an android 9 update. maybe that would help?

Chris Swanson16:07:59

adb install is still just stuck on "Performing Streamed Install"


Something is odd there. Copying that big of an app should be pretty quick, like seconds quick.

Chris Swanson16:07:39

yea, when it worked it was nearly instantly

Chris Swanson16:07:05

maybe i restart adb and try the streamed install again


Not sure about the state of your device. Can you run any other apps on it without an issue ?

Chris Swanson16:07:22

yea, i was using it fine for expo dev


Hmm, odd. Not sure what else to go on of the top of my head here.

Chris Swanson16:07:17

no problem, thanks for the help, at least i learned some things. i'll let you know if i figure it out


Cool, good luck!


Do you have permissions to install apps on your device that are not from the officially blessed app stores @chrisjswanson?

Chris Swanson16:07:33

hm let me check

Chris Swanson17:07:44

hey do you know where it is in the settings? i can't seem to find it


It varies on all the different Android flavours

Chris Swanson17:07:08

i've definitely got developer mode enable

Chris Swanson17:07:23

hm ok let me google my version


It’s not the developer mode, it’s the permission to install the app directly on your phone, that is not from Google Play store or equivalent app walled garden.

Chris Swanson17:07:04

cool thanks let me look at that

Chris Swanson17:07:31

when i google android 9 it says "unknown sources" option has been removed, you need to copy apk and install then click to approve it

Chris Swanson17:07:48

but adb push crashed halfway too 😐

➜  my-app adb push  /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk /sdcard/Download
adb: error: failed to copy '/home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk' to '/sdcard/Download/app-debug.apk': couldn't read from device
/home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk: 0 files pushed. 4.1 MB/s (24441944 bytes in 5.661s)

Chris Swanson17:07:02

so something is really weird with my adb i think

Chris Swanson17:07:28

it hit like 75% and then crashed like that


I’d say that adb works fine probably, but the permissions on your device is where the issue lies


Do you have enough space on your SD card ?

Chris Swanson17:07:02

yea it claims to have 21G free

Chris Swanson17:07:59

hm it crashed on a different phone too


With the same error?

Chris Swanson17:07:55

this time it acually gave me more info

Chris Swanson17:07:09

told me to try with gradlew , which gives a stack trace

Chris Swanson17:07:40

➜  android ./gradlew app:installDebug

> Task :app:installDebug
05:20:42 V/ddms: execute: running am get-config
05:20:42 V/ddms: execute 'am get-config' on '8BLY10KEB' : EOF hit. Read: -1
05:20:42 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Pixel 3 XL - 9' for app:debug
05:20:42 D/app-debug.apk: Uploading app-debug.apk onto device '8BLY10KEB'
05:20:42 D/Device: Uploading file onto device '8BLY10KEB'
05:20:42 D/ddms: Reading file permision of /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk as: rw-r--r--
05:20:48 D/ddms: read: channel EOF
05:20:48 E/Device: Error during Sync: EOF
Unable to install /home/cswanson/workspace/mobile/my-app/android/app/build/outputs/apk/debug/app-debug.apk EOF
Caused by: EOF
        ... 74 more

> Task :app:installDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:installDebug'.

* 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 

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.

44 actionable tasks: 1 executed, 43 up-to-date


Does that new device have the permissions to install Dev builds?

Chris Swanson17:07:50

according to the doc you sent, it seems there is no longer blanket approval for dev builds past android 8

Chris Swanson17:07:19

you have to copy the apk first and click it , then give it permission to install just that app and it will remember

Chris Swanson17:07:50

but i can't even copy the apk via adb , because that crashes. and that's before we ever get to install ,so i wouldn't expect the permission to matter

Chris Swanson17:07:04

maybe i can try a different method to copy the apk like gdrive

Chris Swanson17:07:02

ok so i copied the apk with gdrive and installed it with package installed, it told me it was blocked by play protect, and i had to approve it manually

Chris Swanson17:07:08

now the apk is installed


Great! Can you run the app?

Chris Swanson17:07:39

yep now it runs, and i've got a figwheel prompt 🙂


Cool. There must be a switch in your settings that relaxes this stringent check

Chris Swanson17:07:31

now the question is can react-native push new builds with adb , or i have to copy the package every time

Chris Swanson17:07:42

maybe that play protect can be disabled


It must be configurable

Chris Swanson17:07:05

have to disable it from play store instead of settings now

Chris Swanson17:07:14

let me uninstall and give it one more go

Chris Swanson17:07:18

bummer , still hangs with the permission error

Chris Swanson17:07:30

but at least i'm on the right track now

Chris Swanson19:07:41

finally figured it out

Chris Swanson19:07:35

of all things... i run linux in vmware. my vm's virtual usb controller was defaulted to usb 2.0 compatibility mode. Bumping it to 3.0 solved the issue outright.

Chris Swanson19:07:30

so if your adb keeps hanging and your device keeps going offline, and/or your package is hanging on the final install step, and your run in any virtual environment for dev; check that your virtual usb controller is in 3.0 compatibility mode, not 2.0. Hope that saves someone else a few hours.

👍 4
Chris Swanson19:07:59

@dotemacs thanks again for all your help troubleshooting

👍 4