Related
i'm trying to install my app debug from my android studio. it's work well yesterday, but today when i try to install it again, the application cant be installed on my device and showing error like below on my android studio.
Installation did not succeed.
The application could not be installed: SHELL_UNRESPONSIVE
The device timed out while trying to install the application.
Retry
what should i do? i tried install on other device, and it worked fine. My device is Redmi 4X and other device is Samsung J3
Faced the same issue, not sure of the reason but in Android studio, Click on the File -> Invalidate Caches/ Restart and then it starts to work.
I got same issue with my device. i restart my device and its work properly.
The problem is because you don't have the proper SDK for the Android version. I'm telling you because a month has passed for me too. The solution is to download the appropriate pack in the SDK Manager.
If you have doubts how to enter:
Close the project.
In the welcome panel click on settings, then choose the SDK Manager option.
Click show package details and select the version for Android and choose all packages.
Finally you click ok XD
Try this method if it works perfect greetings
If other answers didn't help and previously application was installing correctly on your device, try to check your AndroidManifest file. Check that nothing forbids to install your app because of os version conflict or manifest merging errors or other reasons.
I came across this problem recently, through process of elimination I determined the cause was related to dependencies in the build.gradle(your app name).
I suggest working backwards and comment out everything that was added since the last known working build/install.
In my case I have a legacy app developed back in 2016 being rewritten, dependencies for signalR have changed quite a bit since then, the original libs where causing the install to fail while everything else seemed excellent, not even a single build error was occurring. Commenting out the libs and references got the application to a runnable state.
In my case, I deleted the emulator and recreated it. It solved the issue.
Before this, I had already tried following which did not work for me:
From menu: File->Invalidate cache/restart.
Deleting .cxx, .idea, .gradle, build folders and rebuilding.
Cold boot device emulator
Posting this in case someone is trapped in my kind of situation.
Yesterday my app was running perfect from Android Studio but today when I started working on my app and running it i am getting error message continuously
Installation failed with message Failed to establish session.
Screen :
On click OK getting error message
Session 'app':Error Installing APKs
And App is not exist(already Uninstalled) in device. Please suggest me what to do ?
Again in this issue also I found Instant Run buggy. When I disable the Instant run and run the app again App starts successfully installing in the Device without showing any error Window.
I hope google will sort out these Issues with Instant run soon.
Steps to disable Instant Run from Android Studio:
File > Settings > Build,Execution,Deployment > Instant Run > Un-check
(Enable Instant Run to hot swap code)
If you use MIUI ROM
Go to the developer option and in that disable MIUI optimization.You will be asked to reboot your phone.
Reboot it and then run the app.
Your APK file is missing . So , Clean Project >> Build APK >> Run the project .
For those who uses Xiaomi phones, follow these steps:
Settings-> Additional Settings-> Developer options
Turn off MIUI Optimization and reboot your phone
Last Disable verify app over USB
Your device will respond properly.
Also enable install via USB
I had the same issue in Android studio 2.3 when I tried to test the app using Xiaomi's Mi5 and Mi4 phones. Disabling instant run didn't help me. So here is what I did.
Turn Off MIUI optimization in the Developer Options in the phone.
Then the device will be rebooted and then you'll be able to test the app over the phone.
Using this method you can still use instant run option in android studio. So this will fix your problem at least temporary. Hope that we'll be able to use MIUI optimization in the near future updates :)
In my case, it was because my emulator ran out of disk space.
In my case, it was very a silly and funny mistake. I, accidentally without actually knowing, checked "Android Debug Bridge, Use libUsb backend". Actually it should stay unchecked..
In Mac Pro, Go Preferences - > Build, Execution,Deployment -> Debugger.
**** For MAC OSX/Windows ****
Goto *
Android Studio - Preferences (In OSX)
Android Studio - File -> Settings (In Windows)
in the menu bar then select
Build,Execution,Deployment - Instant run
then uncheck it and rebuild it will works
Finally I've SOLVED it!
Below a temporary solution. Issue was reported to Google.
First of all I found in Run log that Android Studion 2.3 tries to install app-debug.apk from many slices, like this:
$ adb install-multiple -r
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_1.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\dep\dependencies.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_0.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_2.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_9.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_4.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_3.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_5.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_8.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_7.apk
E:\Android_Projects\ActivityLifecycle\app\build\intermediates\split-apk\debug\slices\slice_6.apk
E:\Android_Projects\ActivityLifecycle\app\build\outputs\apk\app-debug.apk
Then I tried to install only app-debug.apk from command line by:
adb install -d E:\Android_Projects\ActivityLifecycle\app\build\outputs\apk\app-debug.apk
App was installed successfully but was failed to run on my phone.
And finally:
I recompiled app-debug.apk from command line as:
gradlew.bat assembleDebug
Repeat installation of app-debug.apk from command line and became happy:
adb install -rd E:\Android_Projects\ActivityLifecycle\app\build\outputs\apk\app-debug.apk
This is definitely some gradle problem in AndroidStudio 2.3.
Go to Build --> Clean Project --> Run
Thats all it takes.
I had the same issue in MIUI. Enabling OEM unlocking worked for me without disabling MIUI optimization.
Below is a screenshot of my Redmi 3s prime developer options setting:
In my own case, it was because my phone was out of space. For people that are facing this problem right now, if Clean Project + Build APKs does not work, check the available space on your phone or emulator.
I hope this helps.. Merry coding!
I found the solution go to
settings>build,execute,deployment>instant run>Enable instant run to hot swap code /resource change on deploy(unchecked this option)
This will work on 3.4 android studio too. thanks
Try disabling the Instant run in Settings.
Easily can be solved this problem.
Ex:- in Huawei GR3 mobile,
Goto Setting in your mobile -> Storage -> Storage Cleaner
Change your applicationId in the android/app/build.gradle file.
For example:
// Change this
applicationId "com.example.myAndroidApp"
//
// to this
applicationId "com.example.somethingElse"
Then Sync your gradle then you can able to install your app,
if the previous applicationId is your production id the again change it the previous one now the device will allow to install the app.
Hope this may help you....
This is caused by "instant run" feature, you can disable it by:
Open the Settings or Preferences dialog. Navigate to Build, Execution, Deployment > Instant Run.
Uncheck the box next to Enable Instant Run and u are ready to go.
At me such error arose after renaming of a folder with the project.
Disabling Instance Run helped, but what if you do not need to disable it?
I deleted all the tags mentioning the old folder name from the file myproject\app\build\intermediates\restart-dex\debug\build-info.xml
The error has disappeared.
Just do the following step...
Build>Clean Project
after that Run project again, this worked for me
I also had the problem after globally changing the project name, applicationid and the folders containing the java files.
Disabling Instant run helped, but was not a good option, so this helped:
close Android Studio
deleted those files and folders: rm -Rf .gradle .tags local.properties .idea/workspace.xml .idea/caches/* .idea/libraries app/build
start Android Studio and let it resync everything
press run
Faced same issues on MIUI phone resolved by making MIUI account and enable install by USB.
just close your emulator and run again the problem will be solved happy coding
Sometime app doesn't show on home screen,So
Check your apps by going to setting - > apps -> and then uninstall from app setting might this work.
Here's my solution (there's no need to deactivate instant run) Do all these steps in the stated order:
1- Gradle Build (root level)
gradle
2 - Gradle build + clean (app level)
gradle app
3 - Choose app on the top bar (left of Run 'app')
4 - Clean Project:
Navigate to Build > Clean Project
And it should work now! You shouldn't disable instant run if you follow these steps
In my case Instant Run hided the real cause of the problem which was INSUFFICIENT_SPACE due to small data partition and I also got "failed to establish session" error. After disabling Instant Run, the real problem was revealed and after fixing it and enabling Instant Run it worked.
Allow or enable "Installation from USB" in the developer options.
One problem in MAC(or may be other operating systems) can also be solved with this
You need disable "Use libusb backend" in preferences--> debugger
Please tell others if this was useful for you.
Thanks to the following user and their answer: https://stackoverflow.com/a/58095554/3726185
Go to USB Debugging and disable MIUI Inspection and allow the phone to reboot. Things should be fine from here
For me I had to close the emulator and then select cold boot when re-opening it.
Before trying anything else in this post, I would do Build >> Clean Project. It solved my problem and it is the simplest solution. Sometimes, the cleaning doesnt get some links, so I also recommend you to restart your devices, either virtual or physical.
If it doesnt work out, try turning of Instant Run by File > Settings > Build,Execution,Deployment > Instant Run > Un-check
Only after trying this two simple solutions, I would try the others.
When I hit run, Android Studio installs the app on my device (not emulator), but sometimes the code does not change (e.g. some Logs still output to the console whilw they actually got removed).
I faced a similar problem before: When I tried to install the app, Android Studio said there were no changes made, so it canceled the process. I could solve this problem by unchecking "Skip installation if APK has not changed" in "Installation Options". (I disabled "Instant Run" as well).
Since Android Studio now returns "Success" when I run the app, I thought the problem was my device, so I restarted it, but nothing changed. Then I cleaned the caches of Android Studio, restarted AS, installed the app and it worked...
Because I don't want to clean my cache and restart Android Studio every hour, I look for a solution on this problem. Any suggestions?
This happens occasionally for me, and the best solution I've found is uninstalling the app from my phone and reinstalling it. To uninstall the app, hold down on the icon in the app list menu and drag it to the uninstall field. It should always reinstall with the updated code.
I am having difficulty importing a project written on Android Studio 1.1 into Android Studio 2.1.2. I keep getting this error whenever the gradle is building before testing the app on a tablet. Below is a screen shot of the error. Does anyone know what the problem could be?
I have tried adb kill-server followed by adb start-server as well as some other gradle versions compatible with the project. Other than this, I have not been able to find many more suggested solutions to the problem ("session 'app': error installing APK").
Additionally, I have tried uploading a basic Hello World project which successfully built the gradle.
Error message from Grable Build
I was facing similar kind of problem.There is image of error attached.Error is highlighted in red.
Turning off the Instant run removed error for Android Studio 2.3 and 3.1.4.
Best step to resolve this error is-
Uncheck the instant run in File >Settings >Build,Execution,Deployment > Instant Run
Note: The top answers recommend to disable Instant Run. Try this before exploring my listed solutions to prevent wasting more time than needed.
Here are some possible solutions:
1) Make sure that your phone is properly connected to your PC with a USB cable: Before going over these fixes, make sure that you have at least connected your phone to your computer properly. If it's properly connected, your phone should be charging.
2) Make sure that your device's driver software is up-to-date: Simply go to your File Explorer and then right click Computer. Then, select Manage (requires administrator privileges). In your Computer Management window, find a tab on the left pane that says Device or Device Manager. Search for your device from there. Mine was under Portable Devices and the name started with SAMSUNG, so finding your device shouldn't be too hard. Right click the device, and then select Update Driver Software.... I chose the Search automatically for updated driver software option, since it's much easier.
3) Enable USB debugging under your Developer Options: For my Samsung Galaxy S9, I found mine under Settings > Developer Options. From there, enable USB Debugging. If you can't find your Developer Options, find your build number within the settings and tap it 7 times consecutively. I found mine under Settings > About Phone > Software information.
4) Make sure you've allowed USB debugging for your specific computer: Although you may have your USB Debugging option enabled, you still need to allow USB debugging for your specific computer. A popup should appear asking Allow USB debugging? and providing the computer's RSA key fingerprint. Before pressing OK, make sure your check Always allow from this computer, so that you don't have to go through this again in the future. If you think you've done this but yet your device is still marked as OFFLINE, select the Revoke USB debugging authorization option in 'Developer Options'. Then, re-allow your computer for USB Debugging. If the popup doesn't appear, reconnect your phone to the Computer (pull the cable out and put it back into your Phone).
5) Trying cleaning AND rebuilding your project: In Android Studio, open up the Build tab at the top left and try both the Clean and Rebuild options.
If none of the above works out: Reinstall Android Studio by Uninstalling the program and re-downloading the setup file here. Scan for any viruses that may be affecting your computer. Check for any sort of error while reinstalling Android Studio. If none of the methods presented in this answer work, fetch for support here.
Good luck.
Follow this steps to overcome the issue.
Disconnect all devices connected to System/Close all emulators
running on System.
Turn Off Instant Run feature from settings.
Perform a clean build.
Turn ON Instant Run feature from settings.
Perform a clean build.
Connect your device/start your Emulator and ensure it is online.
Run the Project by selecting the device/emulator.
NOTE:-
1) You should not have different instances of Android Debug Bridge(adb) running on system.
2) If using Genymotion then make sure that you use the custom sdk path mentioned in the Genymotion settings the which you mentioned in the settings of Android Studio.
Follow all the steps and I am sure you will get the issue fix.
You can clean your project with gradle wrapper of your project. In linux:
$./gradlew clean
In windows:
>gradlew.bat clean
This error happens due to Gradle not synced with the project. go to Tools- Android- Sync Project with Gradle files. Then Run it again.
On newer Android Studio versions, go to File-> Sync project with gradle files
Very Simple.
Follow this :
Build -> Clean Project
Then
Build -> Rebuild Project.
This is a terrible problem, i have facing it so much time, First of all when you run on emulator or real device please make sure that it is not show device is offline in Android monitor, see picture below due to bad cable connection device is showing offline, so make sure first that it is online.
If it's Okay then clean your project and Rebuild your project. You can do it from Build -> clean project / Build-> Rebuild project
Still problem occurs then try to Restart android studio. This is generous error happens due to above cases.But i solve it this way as described.
None of the above worked for me, the simplest solution was to go to
File > invalidate caches/restart > invalidate and restart
This issue seems to be bug in Android Studio.
I tried all other workarounds but the issue was appearing randomly.
I also have custom named apk for output. But Android studio was randomly picking custom apk name and default apk name.
Adding Gradle-aware Make solved the issue.
Following are the steps.
Menu Run -> Edit Configuration
Select "app" configuration
Add Gradle-aware Make to Before Launch actions
You are done.
Following article helped me in finding the solution
https://android.jlelse.eu/android-studio-3-1-how-to-fix-it-b49f72eb054f
It's a bit late for reply but, i've figured out how to solve this problem on Android Studio 3.1.
You can have "Instant Run" checked, what you need to do it's just to build an APK
and then retry to Run your app.
Hope this help!
In my case, my project location contained the special character.
E:\Android_Projects\T&PUIET,KUK\app\build\outputs\apk\app-debug.apk
close android studio > rename folder containing the special character(here T&PUIET,KUK ) > restart android studio.
Hope this Solution helps!
Clean and Rebuild is working fine for this problem and it is good also than other solutions.
In my case my device didn't have enough memory. After trying out a number of the suggestions here, I finally noticed the notification on my phone about low memory. The notification had been there for hours apparently.
I could install app on Nexus, but couldn't on Samsung. Nothing helped me except the change of the USB cable.
mi users if you are facing this type of issue follow these steps:
Step 1 : generate developer options as follow
Settings>>About Device>>Click 7 times on MIUI Version>> It will Generate Developer Options.
Now Enable Following...
Step 2: Setting>Additional setting> Developer options> Enable USB Debugging
Step 3: Setting>Additional setting> Developer options> Enable Install via USB
Note: Its Will get Enable Only If You Insert SIM In MI Device/Phone.
Step 4: Setting>Additional setting> Developer options> Enable Verify apps over USB.
all done now run the project and test....
non mi user:
just enable once instant run options from the settings--> Build,Execution, Deployment-->Select Instant Run and Enable Check Click On OK...
Its Will Work....
Try to this way :
1) In Instance Run is Enable then desable it.
2) Save it and Rebuild the project.
3) Check devices is online or USB debugging On your device.
4) Then Run It App On your devices.
Note :
If you use mobile device is MI (Xiaomi) Then Check :
=> setting>Additional setting> Developer options> Install via USB (ON it)
=> setting>Additional setting> Developer options> USB debugging (ON it)
=> setting>Additional setting> Developer options> Verify apps over USB (ON/Off it)
Trying cleaning AND rebuilding your project: In Android Studio, open up the Build tab at the top left and try both the Clean and Rebuild options.
This problem occurs when you copy paste class and didn't change package name.
Means Package name are different. Build has no problem to build but its problem to install.
After trying the different solutions from the different answers, I tried changing the USB debugging cable, and the problem resolved finally.
In my case, going to Settings>Build, Execution, Development>Compiler>Command-line options and removing the --dry-run flag fixed it for me. Not sure why that was there in the first place, but it solved it for me.
I was facing same problem.Tried every think mentioned here in blog.
But it was basic error to permit device "allow installing app from USB" which did it for me.
I had similar problem. In my device I have two accounts and the app was remained installed in another account. I have deleted app from both of the accounts and it was done.
I was able to resolve it simply by opening the notification bar of the android phone , clicking on "tap for more options" and selecting PTP
i was also getting the same error repeatedly but could not solve it as i am complete new to android development.
But then it came to my mind that the error is appearing because its not able to install the apk in the device as the error says.
So i make sure that my Oneplus3 is in debugging mode and also allowing file transfer when connected via USB.
And this solved the problem.
Also previously it was not doing the instant run but now it does.
So check whether your android device is allowed to transfer files while connected via USB. This might help.
Here is gradle console updates:
5:01 PM Gradle build finished in 1s 252ms
5:13 PM Executing tasks: [:app:assembleDebug]
5:13 PM Gradle build finished with 15 error(s) in 1s 125ms
5:15 PM Executing tasks: [:app:assembleDebug]
5:15 PM Gradle build finished with 13 error(s) in 1s 608ms
5:16 PM Executing tasks: [:app:assembleDebug]
Turning off the instant run(File >>Settings >>Build,Execution,Deployment >> Instant Run), solved my issue
I was using CyanogenMod 12.1 and was building with libgdx when I met with the same error.
Rebuilding didn't work for me.
My phone was connected as UMS or USB mass storage to my PC when I ran the app. Just changed the USB configuration from mass storage to MTP and it fixed my problem.
Looking at the error message, Android Studio tried to install older version of apk (lets say 0.5.1) while current version is lets say 0.5.2. Android Studio builds 0.5.2 but tries to install 0.5.1 for some reason.
I have turned off Instant Run, invalidated and restarted, rebuilt project and didn't help.
Solution worked for me is to uninstall the app, then change the current branch on VCS to some other branch. Then come again to latest branch and Rebuilt, Install the APK again.
You just need to restart your adb.
Instruction for that is given in this Link
My problem is that when I ran my app and use my mobile device the app isn't updated with any of the changes I've made to the code. I've checked the 'Android Device Monitor' and it sees my phone. Yesterday I downloaded 'universal adb driver' because I was trying to print a logcat. I thought that downloading this driver despite already having USB google driver might have caused the issuse. I've uninstalled univeral adb driver but the problem persists. Can anybody help me
I know I am late, but if anyone else comes here, run Build>Clean project.
It's a bug in Android studio. That crap is ancient, and still not fixed.
You need to go to Run > Edit configurations... and disable the "Allow parallel run" checkbox at the right top corner of that window, it will even solve the problem that your activity don't run after app build. It's only one solution which was helped to me.
Simply uninstall the application from your mobile device and then run your app again with your device connected and make sure to select the correct device when Android Studio prompts you to.
Try Re-build the gradle. I should work for you. Sometimes if the build id processing and your usb cable is removed or not connected properly, there might be chance to get this issue.
Also, Check the error logs in the studio. They will tell you what exactly you need to do.