_react-native init demo && cd demo_
_react-native run-android --deviceId ZY2243ZMVC_
--_This caused an error_:failed to find the app-debug.apk
--But after Manual installation, it was successful
_adb install app-debug.apk_
from android/app/build/output/debug/app-debug.apk
"react": "^16.0.0",
"react-native": "0.51.1",
Andriod Sdk: 26.0.2
--Should have installed the apk without any issue
--Having Problem with all android devices
**BUILD SUCCESSFUL in 2m 18s**
164 actionable tasks: 3 executed, 161 up-to-date
Running /home/rivertech/Android/Sdk/platform-tools/adb -s ZY2243ZMVC reverse tcp:8081 tcp:8081
adb server version (36) doesn't match this client (39); killing...
* daemon started successfully
Installing the app on the device (cd android && adb -s ZY2243ZMVC install app/build/outputs/apk/app-debug.apk
**adb: failed to stat app/build/outputs/apk/app-debug.apk: No such file or directory**
Command failed: /home/rivertech/Android/Sdk/platform-tools/adb -s ZY2243ZMVC install app/build/outputs/apk/app-debug.apk
**Could not install the app on the device, read the error above for details.**
Starting the app on ZY2243ZMVC (/home/rivertech/Android/Sdk/platform-tools/adb -s ZY2243ZMVC shell am start -n com.demo/com.demo.MainActivity)...
Starting: Intent { cmp=com.demo/.MainActivity }
Error type 3
Error: Activity class {com.demo/com.demo.MainActivity} does not exist.
I had the same issue. I think the problem is when android studio starts building this app-debug.apk. For some reason, this directory android/app/build/output/apk has child directories debug and release. This is why react-native-cli throws No such file or directory because it cant find it. The app-debug.apk is in debug directory.
I moved the apk to android/app/build/output/apk
@chipcerio you're right
just use the command
adb -s [deviceId] install android/app/build/outputs/apk/app-debug.apk
has anyone solved without c&p that fdebug.apk manualy? and adb install?
put this in your android/app/build.gradle
def enableSeparateBuildPerCPUArchitecture = false
you are creating this for multipe cpu architecture that's why it is failing
I found that running with --deviceId parameter cause this problem, when I run only react-native run-android there's no problem.
Try this:
adb -s [deviceId] install android/app/build/outputs/apk/app-debug.apk
I reopen this thick as I guess this is a bug: currently, when building release variant and specifying the deviceId, the debug-apk filename is tried to be installed on the device. This is wrong. In stead, the filename for the release apk should be used.
cd android && adb -s {{THE_GIVEN_DEVICE_ID}} install app/build/outputs/apk/app-debug.apk
Should be:
cd android && adb -s {{THE_GIVEN_DEVICE_ID}} install app/build/outputs/apk/release/app-release.apk
Hey this is still an issue, is there a solution for not moving the apk by hand?
You could use a hook to copy over the apk
Updated the correct path on @datvp09, was missing /debug/
react-native-cli: 2.0.1
react-native: 0.57.3
Connect your Android device via USB:
> adb devices
List of devices attached
988se6666555453 device
> adb -s 988se6666555453 install android/app/build/outputs/apk/debug/app-debug.apk
> react-native run-android --deviceId 988se6666555453
Why this is closed? So the recommended way is compile apk first and than manually use adb install to install on a specific device? No plan to fix the --deviceId option? I think it's better to fix the deviceId option right? Otherwise if it's not working then what's the point of having that option.
@ysyyork I closed it as a workaround had been posted, and no one left a comment for a few months after that. If you think this should be fixed in the react-native CLI, a group of contributors have forked the CLI into a new repo at https://github.com/react-native-community/react-native-cli. Please consider opening an issue there, as the CLI has been removed from this repository.
@hramos I see. Sounds good. Thanks
For the lost souls of the future: The reason this breaks can also be that you've changed outputFileName somewhere in a build.gradle file. The apk seems hard-coded to app-debug.apk which means React Native will try to install the wrong file. In case you just changed the name, you may see see symptoms of the app not updating.
@scarlac i've not changed de outputFileName and the error occurs only when i use --deviceId option as reported by @datvp09.
Most helpful comment
I found that running with
--deviceIdparameter cause this problem, when I run onlyreact-native run-androidthere's no problem.Try this:
adb -s [deviceId] install android/app/build/outputs/apk/app-debug.apk