Skip to content

adb: failed to stat app/build/outputs/apk/app-debug.apk: No such file or directory #18243

Closed

Description

@dineshmm23

How i started my project

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

Environment

"react": "^16.0.0",
"react-native": "0.51.1",
Andriod Sdk: 26.0.2

Expected Behaviour

--Should have installed the apk without any issue
--Having Problem with all android devices

Actual Behaviour

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

Activity

  1. chipcerio commented on Mar 16, 2018

    @chipcerio

    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

  2. datvp09 commented on May 2, 2018

    @datvp09

    @chipcerio you're right
    just use the command
    adb -s [deviceId] install android/app/build/outputs/apk/app-debug.apk

  3. nerjok commented on May 6, 2018

    @nerjok

    has anyone solved without c&p that fdebug.apk manualy? and adb install?

  4. Abby3017 commented on May 26, 2018

    @Abby3017

    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

  5. datvp09 commented on May 26, 2018

    @datvp09

    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

  6. dirkpostma commented on Aug 23, 2018

    @dirkpostma
    Contributor

    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
    
  7. rafaelmaeuer commented on Oct 5, 2018

    @rafaelmaeuer

    Hey this is still an issue, is there a solution for not moving the apk by hand?

  8. devsimatech commented on Oct 19, 2018

    @devsimatech

    You could use a hook to copy over the apk

  9. rafaelmaeuer commented on Oct 19, 2018

    @rafaelmaeuer
  10. gildardoperez commented on Oct 19, 2018

    @gildardoperez

    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

  11. ysyyork commented on Jan 20, 2019

    @ysyyork

    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.

  12. hramos commented on Jan 22, 2019

    @hramos
    Contributor

    @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.

  13. ysyyork commented on Jan 28, 2019

    @ysyyork

    @hramos I see. Sounds good. Thanks

  14. scarlac commented on Mar 13, 2019

    @scarlac
    Contributor

    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.

  15. joaom182 commented on Jun 28, 2019

    @joaom182

    @scarlac i've not changed de outputFileName and the error occurs only when i use --deviceId option as reported by @datvp09.

  16. locked as resolved and limited conversation to collaborators on Aug 8, 2019
  17. added
    Resolution: Locked
    on Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: Locked

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions