Related
I am having the following problem when running or debugging apps on a device or emulator with Android Studio. The application is installed but it is not started on the device (or emulator). In the Run window I can see the following:
Launching app on device.
Waiting for process to come online...
and after some time I see the following:
Timed out waiting for process to appear on 'device'...
I have attached a screenshot that shows the problem.
The problem started recently. I am using the latest version of Android studio (3.5.1) and a Google Pixel device running Android 10 but the problem happens on emulators and other devices running previous versions of Android. The problem also happens on two different computers, with different Android applications and devices - the common factor is Android studio. Finally, the problem seems to have started after I updated Android Studio to 3.5.
Does anyone know how to fix this problem? I have tried many things (clear cache, rebuild, invalidate and restart, etc) without success.
Any ideas?
You mentioned that restarting Android Studio didn't work for you...but it worked for me...
File > Invalidate Caches / Restart... > Just Restart
Android Studio 3.6.2
Build #AI-192.7142.36.36.6308749, built on March 18, 2020
There is a bug in the recent Android Studio release. You can revert to previous version or test it from command line.
For me the problem was that I accidentally removed the Launch of the Default Activity in the "Run > Edit Configurations..." option.
Just insert the "Default Activity" under "Launch Options" and your application will run again on your device.
For me, it took marking the build as "debuggable" in the application build.gradle file.
For example:
android {
//...
buildTypes {
// ...
releaseStaging {
debuggable true // <- add this line
signingConfig signingConfigs.release
applicationIdSuffix ".releaseStaging"
versionNameSuffix "-STAGING"
matchingFallbacks = ['release']
}
}
}
Remember to remove this before building release APKs though!!!
Even if I faced the timed out issue in one plus and followed steps that fixed for me.
Go to the respective app
Hold for 3 sec > App info> permissions> allow for storage>.
Next, go to adv settings> battery opt > check "Don't optimize.">
Come back and scroll down > display over other apps> enable....
Hope this helps.
I managed to fix the problem by uninstalling Android studio, deleting all relevant files in the user folder (including gradle cached files) and installing the latest version of Android studio. The problem seems to have been fixed after several months. Note that I am now using Android Studio 4.1.
Hey I had this same problem recently, I tried re-starting adb server but no luck, however when I uninstalled the APK present on my device. Then everything was back to normal.
When I tried to run it on a emulator which didn't have application already, it worked perfectly fine.
Hope this helps :) Thank You.
I tried most of the answers from here and on YouTube. What worked for me is updating my Android studio to the latest version; 4.0.
Everything was working fine for me, when I started getting the error described in this question. So I created and started using a different virtual device for the emulator, and it didn't have the problem.
I was using debugging over Bluetooth.
Giving Location permission to the WearOS app on my phone solved the problem for me.
(Bluetooth scan access is restricted in the modern android versions unless fine Location permission is granted)
In case it can help someone...
try one of the following:
Make sure device is not connected the same time via data cable and wifi
2.If you are connecting through wifi, try to connect via data cable.
3.Check maybe your device has some component or anything maybe like fingerprint interfering with the connection.
When these errors occur:
Message in Run
No communication with Run (stacktraces, System.out ...)
No restart button
Install the newest Android Studio version
Try on different virtual devices, some of them are glitched
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.
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
The strangest thing happened overnight. I try to debug an app from Android Studio to Genymotion. I see Gradle build finishing, but the app is never deployed. Thereafter the debug button gets disabled. The same story occurs with the run button. And neither SHIFT+F9 nor SHIFT+F10 work. Has anyone faced this problem as well?
I am using Android Studio 1.5 RC1 and latest Genymotion
If the above solution doesn't work, just try re-installing Android Studio. And when installing, make sure HAXM is installed properly. Use this link for reference. I used to have the same issue too.
Go to Run > Edit Configurations... and setting like this:
I just opened a new Android project thorugh eclipse, I want the application to run on my samsung galaxy s4 which has KitKat 4.4.2 on it, so I opened the project so as Target SDK is 5.0.1 and the compilation will be done with 4.4.2, just when the project opens I get errors, i fixed it by accesing both appcompat and the projects project.properties and changing the target to apk-21. the errors vanish. But ! when I try to debug with my phone or with the emulator it fails, - Installation error: Unknown failure - thats the error, as I looked through the web I saw many people that get through this problem and non of the solutions was posted solved my problem. I will be really glad if someone could help me solve this annoying thing. Thank! !
I had the similar kind of issue and I have resolved the issue following the steps below:
File >> Settings >> Build, Execution, Deployment.
Next click on Instant Run and uncheck "Enable Instant Run to hot swap code/resource changes on deploy".
Apply and OK.
Try building the app again now. It should work now. Enable the Instant Run feature again if you want to.
We had a similar issue in Android Nougat.
Reason happened to be renaming the Project Folder.
Build -> Clean Project
Build -> Rebuild Project
Try this out in case you have altered anything related to Project Structure or Gradle Settings.
It happened for me also. Try to unplug your device and reconnect again. Once done, run adb devices in your command prompt to see if the device is detected successfully.
If yes, then clean and run the project. This worked for me. Give it a try.
Second Option
Try to delete your debug certificate and then restart the eclipse. Do Project clean - build and run the application
Debug certificate path depends on platforms. Find it in
Preferences - Android - Build - Default debug keystore.