Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Upload package to device fails #2720

Closed
ghost opened this issue Sep 15, 2015 · 127 comments
Closed

[Android] Upload package to device fails #2720

ghost opened this issue Sep 15, 2015 · 127 comments

Comments

@ghost
Copy link

@ghost ghost commented Sep 15, 2015

I'm trying to build the default example but it fails uploading the package to my device (Android 5.0):

Exceptions thrown while deploying.

command: react-native run-android

OS: Linux 15.04 64-bits

Log:

: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.InstallException: Unable to upload some APKs

* 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.863 secs
Could not install the app on the device, see the error above.```
@ghost ghost changed the title Push built package to device fails Upload package to device fails Sep 15, 2015
@ghost ghost changed the title Upload package to device fails [Android] Upload package to device fails Sep 15, 2015
@ghost
Copy link
Author

@ghost ghost commented Sep 15, 2015

So I managed to enable the remote dev server via wi-fi and got everything to work generating a debug apk.

It works for now.

Steps (for those who are interested):

  1. cd into /android and run ./gradlew assemble**
  2. upload* app-debug.apk from android/app/build/outputs/apk/ to phone and install it (you might need to enable unknown sources)
  3. Run app, ignore the red screen, errors on the left and Unable to load JS bundle
  4. Shake device to inflate the dev menu:
    • check (true) Auto reload on JS change
    • open Debug server host for device and type your computer IP address
  5. return to your host computer and run on terminal react-native start
  6. restart the app/reload js on your phone and it's ready to go

* I use Pushbullet and it works like charm for this kind of tasks
** Optional: Enable the daemon for faster builds

@kmagiera
Copy link
Contributor

@kmagiera kmagiera commented Sep 15, 2015

Do you have device debugging enabled on your phone? Do you see your device in the output of adb devices command?

@ghost
Copy link
Author

@ghost ghost commented Sep 15, 2015

@kmagiera correct, I tried under adb tcpip (wifi) -> adb connect and usb and got the same error.

@mkonicek
Copy link
Contributor

@mkonicek mkonicek commented Sep 15, 2015

Glad you got this to work. "Unable to upload some APKs" is a generic Gradle error, do you have spaces in your project name by chance? Google gives me: https://code.google.com/p/android/issues/detail?id=180674

@mkonicek mkonicek added the Android label Sep 15, 2015
@flipace
Copy link
Contributor

@flipace flipace commented Sep 15, 2015

I'm experiencing the same issue.

Huawei P8 - Android 5.0
OS: OSX 10.10.4

Enabled usb debugging and allowing all sources. My project name does not contain any special characters or spaces.

Edit: I can confirm that the remote dev server workaround by @peduxe works though.

@ghost
Copy link
Author

@ghost ghost commented Sep 15, 2015

@mkonicek nope the project name is just: rn

@mkonicek
Copy link
Contributor

@mkonicek mkonicek commented Sep 15, 2015

Looks like there are two separate issues here:

  • "Unable to upload some APKs" from Gradle. This is Gradle-specific and I'd Google to find out why this is happening.
  • Getting the app to load JS from the host machine. The steps you described are very similar to the docs, looks like we should add the step to restart the app.

Do you need the step react-native start? I would expect react-native run-android to start the packager in a new window before failing in Gradle.

@ghost
Copy link
Author

@ghost ghost commented Sep 15, 2015

@mkonicek It doesn't get to the point of uploading the app to my device, fails on the first step - also no new window (terminal tab?) is open during react-native run-android.

The react-native server needs to be executing before running react-native run-android?

@kmagiera
Copy link
Contributor

@kmagiera kmagiera commented Sep 15, 2015

@peduxe Try entering android dir inside your project and running ./gradlew :app:installDebug from there.

@ghost
Copy link
Author

@ghost ghost commented Sep 15, 2015

@kmagiera same errors.

@kmagiera
Copy link
Contributor

@kmagiera kmagiera commented Sep 15, 2015

Try running it with --debug

@ghost
Copy link
Author

@ghost ghost commented Sep 15, 2015

@kmagiera nothing, but now outputs much more verbose logs

@kmagiera
Copy link
Contributor

@kmagiera kmagiera commented Sep 15, 2015

Do you mind posting your logs here?

@ghost
Copy link
Author

@ghost ghost commented Sep 15, 2015

@conechan
Copy link

@conechan conechan commented Sep 16, 2015

Met the same issue.

Device: MEIZU m2 note - Android 5.1
OS: OSX 10.10.5

BTW, the workaround provided by @peduxe is also worked for me.

The same application can run on my Nexus 7 (Android 5.1) without issues.

@ghost
Copy link
Author

@ghost ghost commented Sep 16, 2015

@conechan you can connect with adb reverse, no need to set the host machine.

Make sure your device is connected via USB and run adb reverse tcp:8081 tcp:8081, then run react-native start.

@everplus
Copy link

@everplus everplus commented Sep 21, 2015

I also met this problem.

:app:installDebug
Installing APK 'app-debug.apk' on 'Redmi Note 2 - 5.0.2'
01:19:19 E/1160857647: Error while uploading app-debug.apk : Unknown failure
Unable to install /Users/everplus/Documents/Project/CtripFxReactNative/android/app/build/outputs/apk/app-debug.apk
com.android.ddmlib.InstallException: Unable to upload some APKs
at com.android.ddmlib.Device.installPackages(Device.java:920)
at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:113)
at com.android.builder.testing.ConnectedDevice$installPackages$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)

I try to use android studio with project, and that's ok.

@ghost
Copy link
Author

@ghost ghost commented Sep 21, 2015

@everplus yep it does work with AS, I believe it's the adb task to deploy the apk being used by react-native does not work for every device, I tested with a S5 and it worked.

@lazybios
Copy link

@lazybios lazybios commented Sep 24, 2015

I have the same problem, make sure you have allocate enough SD storage for your AVD. That's works for me!

@ghost
Copy link
Author

@ghost ghost commented Sep 24, 2015

@lazybios But i'm deploying to my own device, not the emulator :)

@jianfengye
Copy link

@jianfengye jianfengye commented Sep 26, 2015

I got the same error after I call

./adb reverse tcp:8081 tcp:8081
AwesomeProject  react-native start
 ┌────────────────────────────────────────────────────────────────────────────┐
 │  Running packager on port 8081.                                            │
 │                                                                            │
 │  Keep this packager running while developing on any JS projects. Feel      │
 │  free to close this tab and run your own packager instance if you          │
 │  prefer.                                                                   │
 │                                                                            │
 │  https://github.com/facebook/react-native                                  │
 │                                                                            │
 └────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
   /Users/yejianfeng/Documents/baichebao/AwesomeProject


React packager ready.

[15:38:20] <START> Building Dependency Graph
[15:38:20] <START> Crawling File System

then I call react-native run-android

  AwesomeProject  react-native run-android
JS server already running.
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
Installing APK 'app-debug.apk' on 'GEM-703L - 5.1.1'
03:40:44 E/1825629402: Error while uploading app-debug.apk : Unknown failure
Unable to install /Users/yejianfeng/Documents/baichebao/AwesomeProject/android/app/build/outputs/apk/app-debug.apk
com.android.ddmlib.InstallException: Unable to upload some APKs
    at com.android.ddmlib.Device.installPackages(Device.java:920)
    at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:113)
    at com.android.builder.testing.ConnectedDevice$installPackages$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
    at com.android.build.gradle.internal.tasks.InstallVariantTask.install(InstallVariantTask.groovy:119)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:226)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:589)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:572)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:50)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:27)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:40)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:169)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
: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.InstallException: Unable to upload some APKs

* 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: 11.617 secs
Could not install the app on the device, see the error above.
@ghost
Copy link
Author

@ghost ghost commented Sep 28, 2015

/cc @kmagiera @mkonicek no updates on this issue?

@ghost
Copy link
Author

@ghost ghost commented Sep 28, 2015

@conechan, @everplus, @flipace

So I just downgraded this classpath from the gradle build files,

from 1.3.0 (there's also a newer version: 1.3.1 but it doesn't work as well) to 1.2.0 and successfully it pushed the apk to my device and started the activity, although there's a new error.

Prolly worth a look now:

classpath 'com.android.tools.build:gradle:1.2.0'

@kmagiera
Copy link
Contributor

@kmagiera kmagiera commented Sep 29, 2015

Thanks for investigating @peduxe
Regarding your new error I think this may help you: http://facebook.github.io/react-native/docs/running-on-device-android.html#content

@ghost
Copy link
Author

@ghost ghost commented Sep 29, 2015

@kmagiera It didn't, the error persists.

@lawrence858
Copy link

@lawrence858 lawrence858 commented Oct 4, 2015

I had the same error too, with a virtual device. I got around it by deleting a couple of my apps that were installed on the device, including the previous version of the react native app that I was trying to test. Once I did that the error went away.

@ghost
Copy link
Author

@ghost ghost commented Oct 4, 2015

@yanni858 Well weird, I can't find way to debug any app anymore, even pushing the apk manually. Probably it's a network problem here I got here...

@nicholasglazer
Copy link

@nicholasglazer nicholasglazer commented Sep 15, 2016

Seems like downgrade gradle to 1.2.3 solved my problem with Xiaomi Redmi Note 3. But I have white screen after install. Actually the same bug as here.

@atulrpandey
Copy link

@atulrpandey atulrpandey commented Oct 14, 2016

In my case, the most likely cause to the problem was gradle version 1.3.1 which seems buggy. Switching from gradle version 1.3.1 to 1.2.3 in android/build.gradle fixed the issue for me.
screen shot 2016-10-14 at 1 30 51 pm

@mfkp
Copy link

@mfkp mfkp commented Oct 23, 2016

Interesting update:

I wasn't able to get the build process to deploy to an Android 7.0 device (Nexus 5x) when using gradle 1.2.*. Once I updated it to gradle 1.3.1, I can deploy to the Nexus device again.

@DysaniazzZ
Copy link

@DysaniazzZ DysaniazzZ commented Dec 4, 2016

It works with gradle version 1.2.3, but the original default version is 1.3.1.

@ponty96
Copy link

@ponty96 ponty96 commented Dec 15, 2016

@DysaniazzZ did u also downgrade your react-native version?

@jaxrtech
Copy link

@jaxrtech jaxrtech commented Dec 16, 2016

@ponty96, not entirely sure what the root cause is, but this worked for me:

  • Open the android/ folder as an existing project in Android Studio
  • Run the project and select a target device to deploy to
  • Open a command line in the root folder of your react-native project
  • Run react-native start to start the react package server
  • Force reload the package from the app running on your device
@DysaniazzZ
Copy link

@DysaniazzZ DysaniazzZ commented Dec 21, 2016

@ponty96 Nope, I just downgrade the gradle version and it works.

@navneetccna
Copy link

@navneetccna navneetccna commented Dec 23, 2016

I created a project in react native

my android\build.gradle has classpath 'com.android.tools.build:gradle:2.0.0'

when i am running command

react-native run-android apk generated but not uploaded on the connected device

but when i am running command adb install -r ./android/app/build/outputs/apk/app-debug.apk apk uploaded and working fine

also when i change my android\build.gradle classpath 'com.android.tools.build:gradle:2.0.0' to 'com.android.tools.build:gradle:1.2.3' react-native run-android works fine for me but some plugin are not working

@fred7BF
Copy link

@fred7BF fred7BF commented Dec 23, 2016

the same issue.
Device: MEIZU m2 - YunOS
OS: windows7
@atulrpandey
After I change the gradle version to 1,2.3, It works

@dwilt
Copy link

@dwilt dwilt commented Jan 17, 2017

Changing the gradle version to 1.2.3 in android/build.gradle worked for me too.

@jamesjara
Copy link

@jamesjara jamesjara commented Feb 13, 2017

Same here, fixed with 1.2.3 in android/build.gradle, but it works with the lasted with other devices, so I think this is related somehow in the android version running at the target device

@GuGuss
Copy link

@GuGuss GuGuss commented Feb 21, 2017

I had the same issue when running react-native run-android on the AwesomeApp tutorial with an avd emulator.

I fixed it by recreating a new emulator with the proper CPU/ABI: Intel Atom (x86_64).

I didn't need to change Gradle version.

@Dansyuqri
Copy link

@Dansyuqri Dansyuqri commented Mar 16, 2017

You might want to uninstall the application from your device, and react-native run-android again. Somehow, this fixed for me when I received the error

@thiagoufg
Copy link

@thiagoufg thiagoufg commented Apr 14, 2017

I had to type:
adb kill-server
adb connect 192.168.0.14:5555

Wait a moment then run:

adb devices

This will show you the DEVICE_ID (which i'm gonna call XYZ) of your device running android. It is usually its IP adress followed by the port 5555 (usually, not always).

react-native run-android --deviceId XYZ

The important part was the --deviceId XYZ. Without this, the apk would never get uploaded to the phone.

Then, the app launched with a red screen... i had to shake it, dev settings, adjust the "debug server host & port for device", putting my computer's IP address and port, like this:

192.168.0.15:8081

Lastly, i had to shake my phone again and select REALOD...

it worked for me!

@aelaa
Copy link

@aelaa aelaa commented Apr 16, 2017

@thiagoufg thank you so much! Really works with --deviceId from adb devices, without gradle version fix.

@shimaalynks
Copy link

@shimaalynks shimaalynks commented Apr 19, 2017

@thiagoufg thanks for steps, it worked for me. but still giving me error when reload:

couldn't connect to development server

Edit: I got it fixed, i was mis-understanding by putting mobile_device IP instead of laptop IP :)
after changing everything goes very well

@abdelouahabb
Copy link

@abdelouahabb abdelouahabb commented May 27, 2017

@thiagoufg this is the lonly solution that worked for me, thank you !

@edvaldoszy
Copy link

@edvaldoszy edvaldoszy commented Jul 8, 2017

I solved the problem putting --deviceId right after react-native run-android

@WilliamAnputra
Copy link

@WilliamAnputra WilliamAnputra commented Aug 8, 2017

@thiagoufg your solution works for me putting --deviceId right after react-native run-android

@MalguyMQ
Copy link

@MalguyMQ MalguyMQ commented Aug 26, 2017

Guys & Girls, I faced in the same issues during one night and the solution it's OFTEN to check dependencies linked in your project.

If you have removed package in your package.json and previously linked with react-native link he will not removed every times removed from android/app/build.gradle, android/app/src/main/java/com/wespeek/MainApplication.java and android/settings.gradle...

So the solution is :
run adb devices if your device are connected, you can go to the next step else connect your device

I assume your device is connected, so check :

1 ) edit file "android/app/src/main/java/com/wespeek/MainApplication.java" and remove import & new packageName()

  1. edit file "android/app/build.gradle" and check dependencies, remove compile "packageNameUnUsed"

  2. edit file "android/settings.gradle" and remove "include 'packageNameUnUsed'
    project(':packageNameUnUsed').projectDir = ..."

  3. run `cd android && ./gradlew :app:installDebug" if build succeed you can now run react-native run-android and this will startup build on your device.
    Hope i can help you all 🔥 🔥 🎉 🎉

@plc13141314
Copy link

@plc13141314 plc13141314 commented Oct 26, 2017

@**yaofly2012 **
I try your method,it's worked! thanks

If your phone is xiaomi ,you must close optimization in developer options

@jacek213
Copy link

@jacek213 jacek213 commented Nov 9, 2017

@thiagoufg ur the man!

@rraallvv
Copy link

@rraallvv rraallvv commented Dec 22, 2017

I'm getting

error: unknown option `--deviceId'
$ node -v
v8.4.0
$ npm -v
4.6.1
$ react-native --version
react-native-cli: 2.0.1
react-native: 0.40.0
@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.