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

Failed to establish session #6499

Closed
guanMac opened this issue Mar 17, 2016 · 42 comments
Closed

Failed to establish session #6499

guanMac opened this issue Mar 17, 2016 · 42 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@guanMac
Copy link

guanMac commented Mar 17, 2016

When I used 'react-natvie run-androi', it showed that:

:app:installDebug
Installing APK 'app-debug.apk' on 'MI 4W - 6.0.1'

Execution failed for task ':app:installDebug'.

com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to establish session

my android phone is XIAOMI 4 , 6.0.1

@Kureev
Copy link
Contributor

Kureev commented Mar 17, 2016

@facebook-github-bot duplicate #2720

@facebook-github-bot
Copy link
Contributor

@Kureev tells me this issue is a duplicate of #2720. Let's discuss there, closing this one.

@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Mar 17, 2016
@tiye
Copy link

tiye commented May 18, 2016

Same error here but during ./gradlew installRelease. Also in XiaoMi 4, 6.0.1 . Some logs:

17:26:16.747 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':app:installDebug'.
17:26:20.299 [LIFECYCLE] [org.gradle.api.Task] Installing APK 'app-debug.apk' on 'MI 4LTE - 6.0.1'
17:26:21.840 [ERROR] [org.gradle.api.Task] Unable to install /Users/chen/repo/gist/Demo/android/app/build/outputs/apk/app-debug.apk
com.android.ddmlib.InstallException: Failed to establish session
    at com.android.ddmlib.Device.installPackages(Device.java:894)
    at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:113)
17:26:21.845 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 14.385 secs, idle: 0.049 secs
17:26:21.853 [ERROR] [org.gradle.BuildExceptionReporter]
17:26:21.855 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
17:26:21.855 [ERROR] [org.gradle.BuildExceptionReporter]
17:26:21.855 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
17:26:21.856 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:installDebug'.
17:26:21.856 [ERROR] [org.gradle.BuildExceptionReporter] > com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to establish session
17:26:21.857 [ERROR] [org.gradle.BuildExceptionReporter]
17:26:21.857 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
17:26:21.857 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:installDebug'.
17:26:21.858 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
17:26:21.858 [ERROR] [org.gradle.BuildExceptionReporter]    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute

more log


update: someone told me to install MIUI developer edition and I found it worked. So the problem was that default OS does not gives enough permissions...

@bintvn
Copy link

bintvn commented Jun 12, 2016

Actually this problems comes from all of Xiaomi phones, MIUI block incoming action for installing adb from apk via usb. If you try install manual via "adb install nameofapk.apk" then of your Xiaomi's screen will pop permission that ask you to accept or deny installation from usb. That's the problem why apk won't automatically install when we type "react-native run-android", because that command use silent install via adb to Xiaomi Device. Silent install will not make pop up permission on Xiaomi's screen. So may the question is, how to remember permission access for install apk via adb usb, or maybe disable it.

Thanks

@lironess
Copy link

Seems to not work on Xiaomi Redmi Note 3 too.
Can you please show explained way of solving this issue ?

@Shinichi52
Copy link

you can disable MIUI on developer options after run react-native run-android

@lironess
Copy link

lironess commented Jun 29, 2016

Works !
for those who suffer from this:

  1. enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. You’ll see a pop up which says you are a developer now.
  2. Go back to Settings, Additional settings, Developer options and enable USB Debugging.
  3. Connect your phone to your PC/Mac and on the phone authorize your computer
  4. go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted
  5. Try it now :)

@idisfkj
Copy link

idisfkj commented Jul 1, 2016

This problem confused me for a long time, thank you very much

@danilvalov
Copy link

danilvalov commented Jul 1, 2016

@lironess Thank you! It works!

@huangMingHua
Copy link

@lironess it work Thank you so much

@SanShiSir
Copy link

Many thanks for you!

@VentionYC
Copy link

@lironess Thank you so so much,it works

@qutek
Copy link

qutek commented Sep 24, 2016

@lironess Thanks, you saved my day 👍

@AndyFightting
Copy link

it does not work for me .... i can run on android emulator, but device can not. device is Xiao Mi MIUI8.0, and i try the 5 step upon.........it does not work.......
////////////////////////////////////////////////////////////////////////////////////
: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: 9.064 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
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

@AndyFightting
Copy link

i solved my problem. i change android/build.gradle file line 8, classpath 'com.android.tools.build:gradle:1.3.1' to classpath 'com.android.tools.build:gradle:1.2.3'. it works...

link :http://csbun.github.io/blog/2015/12/starting-react-native-with-android/

@VentionYC
Copy link

把小米开发者选项中最后一行MIUI优化关掉就行

发自我的 iPhone

在 2016年11月23日,15:45,阿贵 notifications@github.com 写道:

it does not work for me .... i can run on android emulator, but device can not. device is Xiao Mi MIUI8.0, and i try the 5 step upon.........it does not work.......
////////////////////////////////////////////////////////////////////////////////////
: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: 9.064 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
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@AndyFightting
Copy link

@VentionYC 谢谢,我关了的,不行。我报的错和题主不一样,我的是com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unable to upload some APKs。我是把gradle:1.3.1 改成 gradle:1.2.3 就可以了。再改回去还是不行...难道只能用gradle:1.2.3??我不知道为什么...先跑起来再说了....

@DDstar
Copy link

DDstar commented Dec 5, 2016

@AndyFightting 我的跟你的一样,改成1.2.3就可以了。。。。1.3.1的也一样不行,用的是MIUI手机,用模拟器的话都不用修改什么就运行起来了

@abhisheksoni27
Copy link

What's the word on this issue?

@miukki
Copy link

miukki commented Jan 3, 2017

works for me. thX!

@t2krew
Copy link

t2krew commented Feb 23, 2017

@lironess Thank you !

@NayeemUrRehman
Copy link

@lironess Thank you!!... after trying all permutations and combination ... finally this helped me to sort the problem ... also advise for every1 here dont use MI phone for debugging it will not allow you to taste the actual flavour of android ... thank you all !!!!

@mdshopon
Copy link

mdshopon commented Mar 5, 2017

@lironess Answer Worked for Xiomi. I think that is the solution for Xiomi handsets. Thanks mate :)

@RomilChristian
Copy link

thank you very much man.

@FlogFly
Copy link

FlogFly commented Mar 7, 2017

thank you very much ,close the optimization mui is works for me

@d4rkm3z
Copy link

d4rkm3z commented Mar 15, 2017

Thanks, work on Xiaomi Redmi 4 Pro/Prime

@ravkr
Copy link

ravkr commented Mar 17, 2017

Thanks SOOO MUCH!
Xiaomi Redmi 3S 😃

@ghost
Copy link

ghost commented Mar 22, 2017

Thanks,
Solution: disabled Xiaomi 5 connection
Namely, pull the usb cable
Because, i charge phone by using usb cable

@pickfire
Copy link

pickfire commented Apr 7, 2017

Thanks a lot.

On redmi note 3s, once I disabled 使用MIUI优化 from settings and now it works.

@juicechu
Copy link

@AndyFightting thx, it work. gradle version change to 1.2.3

@SanalKumarK
Copy link

@lironess That worked for my Redmi note also... Thanks...

@praveen180490
Copy link

Thanks.. That also worked for my Redmi 3S Prime..

@fajrinimamarif
Copy link

thanks

@MrChinmaya
Copy link

@lironess Thanks Buddy. Works for Redmi Note3.

@amit1999999
Copy link

i am using Xiomi readmi 4 it is not woking...i am stuck

@amit1999999
Copy link

any body help,,,,with Xiomi read mi 4 i am working its no working

@Janaksan
Copy link

@lironess Oh man Thank you so much. It's Working. You save my time.

@themakerman
Copy link

Haha works like a charm...REDMI NOTE 4

@yinglovezhuzhu
Copy link

If your android device os version is above 5.0, you need to run cmd 'adb reverse tcp:8081 tcp:8081'

@wajih123
Copy link

my problem in with the emulator its the one thats give me that error

@afresh
Copy link

afresh commented Apr 14, 2018

com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.lovecode signatures do not match the previously installed version; ignoring!

因为手机中已经存在的相同包名的APK,将其删除就行了。

@gupta-ji6
Copy link

@lironess Thanks for the solution! Worked for me.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests