Closed ghost closed 8 years ago
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.
The step described by @cablegunmaster is working for me,
I downgraded graddle to 1.2.3 in build.gradle 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
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.
What went wrong: A problem occurred configuring root project 'App'.
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
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.
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: