facebook / react-native

A framework for building native applications using React

Home Page:https://reactnative.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Android][react-native run-android] app:installDebug error

muraliv opened this issue · comments

[muralive@AwesomeProject ]$ react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee061Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore061Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco061Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline061Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp061Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0110Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug FAILED

FAILURE: Build failed with an exception.

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

    com.android.builder.testing.api.DeviceException: com.android.ddmlib.ShellCommandUnresponsiveException

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 29.7 secs
Could not install the app on the device, see the error above.

##I'm now getting this error:

:app:installDebug
Skipping device 'emulator-5554' (emulator-5554): Device is OFFLINE.
:app:installDebug FAILED

FAILURE: Build failed with an exception.

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

    com.android.builder.testing.api.DeviceException: No online devices found.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 20.503 secs
Could not install the app on the device, see the error above.

The issue was with the Android Emulator. Changed the AVD settings to enable "Use Host GPU" and the issue was resolved.

Yes, this is a problem with the Android SDK being super slow sometimes:

  • ShellCommandUnresponsiveException means installing the APK (simply running adb install) timed out
  • No online devices found means the emulator went into a bad state and is not responding to any adb commands

Using the host GPU and hardware acceleration (HAXM on OSX / Windows, KVM on Linux) usually helps with this. Or switching to Genymotion.

However, there is nothing we can do about this, since the problem is with the Android tooling. Thus, I'm closing this issue.

@muraliv. you are right, thank you (github needs up-vote function)

@muraliv thanks for the solution!

@muraliv Using the host GPU not work for me. still get

......

:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
Skipping device 'emulator-5554' for 'app:debug': Unknown API Level
:app:installDebug FAILED

FAILURE: Build failed with an exception.

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

    Failed to install on any devices.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 27.609 secs
Could not install the app on the device, see the error above.

any solutions ?

@jixiaod In case you missed it, you need to start your emulator before running "react-native run-android"

You can also try Genymotion, it's much faster than the Android Emulator.

hm, my emulator from genymotion is running, but I also got this error. any suggestion?

Try:
1、open android Emulator;
2、react-native run-android; error??!! goto 3;
3、adb install app/build/outputs/apk/app-debug.apk;

@jixiaod any update? I got the error you got.

@swdevbali Same here. Is Genymotion somehow not targeted?

For other coming here, try and downgrade Gradle to version 1.2.3 in your <project-name>/android/build.gradle

#2720

Execution failed for task ':app:installDebug'.
com.android.ddmlib.ShellCommandUnresponsiveException
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

what should i do

@DYQDYQ I faced the same issure, which was sovled by @csholmq's solution.

commented

👍

I had this issue and it was the wrong "Android SDK Build-tools installed".
screen shot 2016-06-06 at 12 48 19 pm

I can't even start the emulator with avd, did anyone knows why?

@wlund-pivotal so simple, but it was exactly my issue, thx! My react-native installation needed 23.0.1, yet I had 24.0.0 installed.

commented
jax$  react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

jax$ adb devices
List of devices attached
192.168.56.101:5555 device

how can I fix it , On my computer .
It's ok for react-native run-ios
and it's ok for react-native run-android on my company computer

@verystrongjoe: how did u resolve it?

I had this issue when trying to run on my actual device. I was able to resolve it by going into Settings -> Developer Options -> Revoke USB debugging authorization. Then unplug and reattach USB data cable and confirm the authorization.

@muraliv ... how can i change AVD settings to select use host GPU ? . i'm using Android mobile to run react-native ... thanks for your help

@bradbumbalough i saw your instruction, i did it. but it couldn't resolve! ... could you tell me detail to solve this problem! .. thanks you very much

I had a similar problem. I changed the android gradle plugin version to 2.0.0 in android/build.gradle com.android.tools.build:gradle:2.0.0

And you may need to update the gradle wrapper under "android/gradle/wrapper/gradle-wrapper.properties"
by changing the version to gradle-2.10-all.zip

try to run the cmd as administrator, sometimes it works for me

I just ran across the same issue. I was doing everything suggested in the documentation but no luck. What you need to do is open your project through Android Studio, click on the AVD manager icon in the toolbar and run your AVD. Then, run react-native run-android in your terminal.

My react-native frozen at 97% anyone got the same problem? : mycode:
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee101Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore101Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco101Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline101Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase101Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp3101Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0442Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug
:app:packageDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE

Building 97% > :app:installDebug

@Kimmer12 I'm having the same issue

My app is already installed on the Android Emulator. So I can see and run them in the emulator.
But it still have same error in the command line

I had this issue but was able to resolve by uninstalling my app from the Android emulator and then reinstalling.

The emulator work well on Android Studio but not when I run the command: react-native run-android

If my device is connected to usb _ see the emulator on my phone.

When I run the command without a device connected to usb
I get this error message:

FAILURE: Build failed with an exception.

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

com.android.builder.testing.api.DeviceException: No connected devices!

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.179 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have

No one has the actual solution for this issue... I'v tried all solution above listed but no changes...

I solved same problem on my Ubuntu 16.04 LTS 64bit with installation:
sudo apt-get install lib32z1

I solved same problem by targeting the device id
adb devices to get the device id
react-native run-android --deviceId id

@phemonick it works for me

commented

@phemonick thanks it works for me.

@Kimmer12 I too got the same error. I figured out that I have some error with the adb and that on typing adb devices nothing shows up. Do you know any tweaks to resolve this?

commented

@phemonick it works for me with real android device

@phemonick same, it's work for me.
and don't forget to check allow always connect when notification of rsa, so no error again :)

Building 97% > :app:installDebug

@Kimmer12, @bashirk, I had the same problem (waiting for infinity on 97%...), I resolved it by choosing another virtual device preferences in the AVD Manager: it should be "Android 6.0  -  API Level 23 - Intel Atom (x86_64)"

on typing adb devices nothing shows up

@Karandeep-Saluja I had this problem too, I guess you have no virtual device installed.
Can you see any devices listed in your AVD Manager?
(You can open the AVD manager using this icon 1_sucjpr_zxzh8n6tbpriyaq in Android Studio)
If no, you have to create one just clicking on " + Create Virtual Device..."

@kate-kholyavkina I figured out the solution. The platform-tools installed on my system was faulty. Had to download one from https://developer.android.com/studio/releases/platform-tools.html

@GerryQuest That worked for me, thank you!

I had same issue with real device, I changed the cable its fixed...
I have 2 devices for test. (samsung s7 and samsung e7) first cable was working with s7 but the same cable did not work with e7...

As @muraliv suggested, I tried changing the graphics, but turns out that is not possible for Google Play enabled devices (which I was using). Created a new AVD without Google Play and it worked - thanks :D

this also happens when you have two adb devices showing up, that's why @phemonick solution works

I worked around this issue by just restarting the emulator and sometimes, keeping Android Studio open in the background while running npm run android seems to work for me

@phemonick it's worked

Deleting the simulator and creating a new might help