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:
`````` sh
: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.```
``````
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):
cd
into /android and run ./gradlew assemble
**app-debug.apk
from android/app/build/outputs/apk/
to phone and install it (you might need to enable unknown sources)Unable to load JS bundle
Auto reload on JS change
Debug server host for device
and type your computer IP addressreact-native start
* I use Pushbullet and it works like charm for this kind of tasks
** Optional: Enable the daemon for faster builds
Do you have device debugging enabled on your phone? Do you see your device in the output of adb devices
command?
@kmagiera correct, I tried under adb tcpip (wifi) -> adb connect and usb and got the same error.
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
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.
@mkonicek nope the project name is just: rn
Looks like there are two separate issues here:
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.
@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
?
@peduxe Try entering android
dir inside your project and running ./gradlew :app:installDebug
from there.
@kmagiera same errors.
Try running it with --debug
@kmagiera nothing, but now outputs much more verbose logs
Do you mind posting your logs here?
@kmagiera It's a bit long
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.
@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
.
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.
@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.
I have the same problem, make sure you have allocate enough SD storage for your AVD. That's works for me!
@lazybios But i'm deploying to my own device, not the emulator :)
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.
/cc @kmagiera @mkonicek no updates on this issue?
@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'
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
@kmagiera It didn't, the error persists.
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.
@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...
@kmagiera @mkonicek found a way to make it work normally but only with the gradle build tools version 1.2.0 and react-native 0.12.0.
On the gradle build tools 1.2.0 > it stills throws the installDebug exception.
On react-native 0.12.0 and gradle build tools 1.2.0, this is the result: https://github.com/facebook/react-native/issues/2720#issuecomment-143886411
Also tried with a really really old Jelly Bean 4.1.2 LG phone I got here but it just worked with react-native 0.12.0. No need to downgrade the gradle build tools (1.3.0/1.3.1 and it's beta versions).
S 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
:app:prepareComAndroidSupportSupportV42300Library
:app:prepareComFacebookFrescoDrawee061Library
:app:prepareComFacebookFrescoFbcore061Library
:app:prepareComFacebookFrescoFresco061Library
:app:prepareComFacebookFrescoImagepipeline061Library
:app:prepareComFacebookFrescoImagepipelineOkhttp061Library
:app:prepareComFacebookReactReactNative0110Library
:app:prepareOrgWebkitAndroidJscR174650Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:preDexDebug
:app:dexDebug
:app:validateDebugSigning
:app:packageDebug
:app:zipalignDebug
:app:assembleDebug
:app:installDebug
Installing APK 'app-debug.apk' on 'MX4 - 5.0.1'
08:30:12 E/1712482281: Error while uploading app-debug.apk : Unknown failure
Unable to install /Users/denghongcai/Workspace/react-native/NodeCar_Controller/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: 47.306 secs
Could not install the app on the device, see the error above.
โ NodeCar_Controller adb devices
List of devices attached
75ABBKL2262S device
same error
@denghongcai You should have something like this:
<project-name>/android/app/build.gradle
<project-name>/android/build.gradle
Also: npm upgrade react-native-0.12.0-rc
on your rn project
Those steps worked for me.
I can't repro this and pretty sure this is related to Gradle / device rather than React Native. Once you find out the root cause can you please send a PR for Known Issues to describe the solution?
@mkonicek it's probably some incompatibility between my device/android version: 5.0 and the gradle build tools plugin, up to 1.2.3 it works well, even better than using Android Studio: when I debug a project it will even between building and starting the activity or throw a error that it couldn't attach the debugger to the activity or not deploying an apk with my code/resource changes.
I can debug and run using Android Studio, perhaps there are other tasks that need to be run before deploying with (react-native run-android
/ ./gradlew installDebug
)?
I have the exact same problem on a Huawei Mate 7 (MT7-L09) Lollipop v5.1.1. However, I tried with a Samsung S III mini (v4.3) and it worked, but the JS server didn't start, so I got that red screen with "Reload JS". I suspect it's a Gradle related issue on Lollipop :question:
@georgenetu You mean the packager didn't start? Run react-native start
.
You will probably need to set your remote host IP manually (shake device/menu button => dev settings) or running adb reverse tcp:8081 tcp:8081
.
@peduxe Sorry, I meant the same build error:
``````
: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.```
``````
@georgenetu Oh yea, so, even after trying one of my patches it still doesn't deploy your APK? Make sure you're on the latest react-native version.
I had this problem with a 64-bit emulator image, but got the install to work using the x86 version.
@whokilledtheelectricmonk are you using the emulator or your own device?
Emulator. Same error message though.
same here using Xiomi Redmi Note 2:
~/Projects/AwesomeProject$ react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
....
:app:installDebug
Installing APK 'app-debug.apk' on 'Redmi Note 2 - 5.0.2'
02:24:04 E/1771561989: Error while uploading app-debug.apk : Unknown failure
Unable to install /Users/wharsojo/Projects/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)
...
solved with @peduxe workaround:
https://github.com/facebook/react-native/issues/2720#issuecomment-140860192
I can deploy it by using the gradle plugin version: 1.2.3 and below
as @peduxe mentioned, after I downgrade my gradle plugin from: 1.3.1 to 1.2.3, everything just works.
my-project/android/build.gradle :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
}
}
Have you tried any of the 1.4 RC versions?
so, what happened between 1.3.1 and 1.2.3 ?
@flipace well, breaking changes :)
@peduxe many many thanks๏ผchange gradle plugin to 1.2.3๏ผ works fine !
@kaiye you're welcome :)
Interesting! 1.2.0 is from April 2015 so it's not an ancient version and we might consider temporarily downgrading (until this is fixed). http://developer.android.com/tools/revisions/gradle-plugin.html
Please feel free to send a PR updating this and cc me:
https://github.com/facebook/react-native/blob/master/local-cli/generator-android/templates/src/build.gradle
@mkonicek Anyone can really change the build file, wouldn't it better to have this on the Android development README? Probably just a minority have this exact problem, I tried deploying to other devices and I didn't stumble upon this issue.
@peduxe That's an option too although by updating the build file we "fix" this for everyone automatically (at the cost of downgrading - is it high?).
The best doc would be this one: https://github.com/facebook/react-native/blob/master/docs/DevelopmentSetupAndroid.md (the README is mostly for contributors to React Native, explaining how to build React Native itself).
I have noticed, that even after downgrading gradle it only worked when I uninstalled the app first.
@jawadrehman It should be replacing the apk on your device whenever you change your project resources, perhaps some error prior to deployment?
@peduxe just to confirm are there problems with using the nexus 6 emulator + android api level 23 ?
with the configuration highlighted
when trying to update the existing app
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unable to upload some APKs
and then when i tried doing it after removing
Skipping device 'nexus(AVD)' for 'app:debug': Could not find build of variant which supports density -1 and an ABI in
@peduxe interestingly this worked without hickup on the 32 bit. maybe there should be a mention that 64 bit throws an error on the support page ?
@jawadrehman I'm not using an emulator - it's really slow (even genymotion), I'm deploying to my device connected via usb/wi-fi
restarting adb helps me resolve this issue
Platform: Win 7 x64
I had the same issue trying to deploy to my device "'Redmi Note 2 - 5.0.2". Downgrading Gradle to 1.2.3 also worked for me. I also tried Gradle 1.5.0 but that did not work either.
I think we could find out more by running the pm
commands manually how Gradle does it:
>> pm install-create -S [APK bytes]
sess id: [sess id]
>> pm install-write -S [APK bytes] [sess id] 0_app-debug -[stream binary APK here]
??? no idea which response would come here
>> pm install-commit [sess id]
And see if anything does fail.
@peduxe thank you, downgrading to 1.2.3 also works for my project.
@peduxe I also works with downgrading to 1.2.3 Thank!!
@peduxe thanks,this just works for me :)
@gapgag55 @repstd :+1:
@peduxe I had the same issue.
The makers should put this in the tutorial:
"Run server first before running the reactive-native run-android command"
How I resolved my issue:
In projectfolder:
$ <projectfolder>cd android
$ <projectfolder>vim build.gradle
and lowered the gradle version to 1.2.3
after that 1 terminal open with:
$ adb reverse tcp:8081 tcp:8081
//startup server.
$ react-native start
//open new terminal Ctrl + Alt + T
in ubuntu go to project folder
$ react-native run-android
@peduxe
"I'm not using an emulator - it's really slow (even genymotion), I'm deploying to my device connected via usb/wi-fi"
so how you connected the device by the wifi? would you give me a link for more details ?
thanks
I have installed AwesomeProject previously from: http://facebook.github.io/react-native/docs/getting-started.html#content
I just had to uninstall it and run react-native run-android
to get it installed properly.
Hey, closing this issue since it's an issue with the gradle setup rather than React Native. Feel free to continue the discussion to find potential fixes/workarounds.
@peduxe change 'com.android.tools.build:gradle:1.3.1' to 1. 2.3 works fine MeiZu Metal M1
@peduxe Thanks a lot.
'1.2.3' worked for my 'MX5-5.1'
zxs:app_lockop zxs$ react-native run-android
JS server already running.
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.htm
i don't know is there any problem with my project.
I downgraded to classpath 'com.android.tools.build:gradle:1.2.3
as well. Can anyone of the team explain why?
My Android Studio build works, all my 15 other gradle-based java projects work, only react-native doesn'tโฆ
For me it's very weird: it works fine with android device 4.3 and it miserably fails with a tablet 5.0
UPDATE: https://code.google.com/p/android/issues/detail?id=180674
Maybe react-native doesn't work with Lollipop?
The link before says the problem is when there are unescaped characters in app name. I've seen the name of the app is app-debug.apk, maybe there is a problem with hyphens too... Is it possible to force a change on the app name in order to try with appDebug.apk?
Changing the version of com.android.tools.build:gradle to 1.5.0 worked for me.
+1
This is still a problem for me - just updated to the latest firmware on my Xiao Mi 4C and the problem still persists. This has pretty much rendered my phone useless as a developer device ;(
com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to establish session
You can still use Android Studio with ReactNative. It will work from there.
Downgrade to 1.2.3.
It doesn't work for me, Xiao Mi 3W, Android 6.0.1.
What went wrong: Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to establish session
Also tried gradle 1.5.0, on the same device, has no luck, it still doesn't work.
@Eissek You rock, downgrading to 1.2.3 did not help me, but upgrading to 1.5.0 did.
@olojiang "Failed to establish session", it is likely the building process failed to communicate with your device via adb. Did you try adb devices
or adb install android/app/build/outputs/apk/app-debug.apk
?
@slott See my comment above.
And also to everyone in trouble with this problem, if ':app:installDebug'
task failed, it means gradle fails to install app-debug.apk
on your device via adb, but the apk itself has been generated.
If changing gradle version does not help, you can always try adb install android/app/build/outputs/apk/app-debug.apk
.
I think it has to do with a permission problem on the device.
As far as I know the gradle plugin copies the apk on the device first and then installs it with "adb shell pm install", which doesn't work.
Could you try running
adb shell ls -l /data
adb shell ls -l /data/local
adb shell ls -l /data/local/tmp
to check the permissions.
By the way, I'm using com.android.tools.build:gradle:2.1.0
and just install the app with Android Studio.
Step 1: Change react-native/build.gradle
version to 1.2.3
classpath 'com.android.tools.build:gradle:1.2.3'
Step 2: Change react-native/gradle/wrapper/gradle-wrapper.properties
to gradle-2.2-all.zip
distributionUrl=https://services.gradle.org/distributions/gradle-2.2-all.zip
Step 3: Run
./gradlew :Examples:UIExplorer:android:app:installDebug
Have fun
@Aspsine Not fun :(
Failed to establish session
@OpenGG I got the same issue like @olojiang.
I can use adb devices and use adb install to install the app. But the screen doesn't show anything, just all blank.
BTW, I can use "react-native run-android" with my emulator which gives me correct result.
My device is Xiaomi 4 LTE, tried gradle 1.5.1
1.2.3
1.2.0
, none of them is working. :(
@jiyinyiyong
MIUI permissions manager blocked the popup window. Make sure allowing your awesomeproject app show popup windows permission.
@Aspsine No chance to change permission, react-native run-android
crash before install apk on device
My device is Xiaomi Note
but work fun on my Nexus 6
@jiyinyiyong
click...ๅฎๅ
จไธญๅฟ -> ๆๆ็ฎก็ -> ROOTๆ้็ฎก็...open root permission..
It works on my MI 4 LTE 6.0.1
@chuguixin In my menu there are "่ชๅฏๅจ็ฎก็" "ๅบ็จๆ้็ฎก็" "USBๅฎ่ฃ
็ฎก็", but no entry related to "root". My MIUI is 7.3.2.0
.
@jiyinyiyong May be need 'ๅผๅ็' not '็จณๅฎ็'
@feit @chuguixin confirmed working after installing MIUI developer edition. Thanks!
Interesting, I just upgrade my gradle to 2.12, and it works.
@g7tianyi just for the interest of trying it won't let me do 2.12 -> got error:
FAILURE: Build failed with an exception.
Could not resolve all dependencies for configuration ':classpath'.
Could not find com.android.tools.build:gradle:2.12.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/2.12/gradle-2.12.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.12/gradle-2.12.jar
Required by:
:App:unspecified
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
1.2.3 is for me sofar the only one that works Huawei P8 Smartphone.
I tried gradle 1.2.3, not working.
Then tried adb install android/app/build/outputs/apk/app-debug.apk
, success.
I'm using MI 4 LTE 6.0.1, enable root permission works for me, without changing gradle version.
Thanks @chuguixin
Same issue with sony d6633
@john-hu I have no idea why gradle's installing process isn't a plain old adb install
, and why it has to be this complicated. Just an advice for everyone that you can add one adb install
command in the building script, bypassing this issue.
Thanks @Aspsine, worked for me. fyi, paths were slightly different and step 3 worked with
$ ./gradlew :app:installDebug
from SampleAppMovies/android/
Same issue in MI 4a. but found the solution:
Step1: go settings -> developer option -> close MIUI optimization
Step2: gradle 1.3.0 to 1.2.3
Yep downgrade to 1.2.0 the gradle and you will be fine
Just for the update, try uninstalling the app from your phone and re-run 'react-native run-android'.
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.
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.
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.
It works with gradle version 1.2.3, but the original default version is 1.3.1.
@DysaniazzZ did u also downgrade your react-native version?
@ponty96, not entirely sure what the root cause is, but this worked for me:
android/
folder as an existing project in Android Studioreact-native start
to start the react package server@ponty96 Nope, I just downgrade the gradle version and it works.
I created a project in react native
my androidbuild.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 androidbuild.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
the same issue.
Device: MEIZU m2 - YunOS
OS: windows7
@atulrpandey
After I change the gradle version to 1,2.3, It works
Changing the gradle version to 1.2.3 in android/build.gradle
worked for me too.
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
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.
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
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!
@thiagoufg thank you so much! Really works with --deviceId
from adb devices
, without gradle version fix.
@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
@thiagoufg this is the lonly solution that worked for me, thank you !
I solved the problem putting --deviceId
right after react-native run-android
@thiagoufg your solution works for me putting --deviceId right after react-native run-android
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()
2) edit file "android/app/build.gradle" and check dependencies, remove compile "packageNameUnUsed"
3) edit file "android/settings.gradle" and remove "include 'packageNameUnUsed'
project(':packageNameUnUsed').projectDir = ..."
4) 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 ๐ฅ ๐ฅ ๐ ๐
@*yaofly2012 *
I try your method,it's worked! thanks
If your phone is xiaomi ,you must close optimization in developer options
@thiagoufg ur the man!
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
Most helpful comment
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!