Application Installation Failed in Android Studio - android

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.

Related

Installing my application to my phone

I have a problem with installing my application to my phone for second time, I set USB debugging and stay awake in the developer setting. For the first time I install and use my app correctly but after I uninstall it by phone and reinstall again by android studio this error has occurred:
I was getting this in Android Studio and all I did to fix it was go to "Build" > "Clean Project" and it just worked.
Its due to your device is not able to uninstall the application properly, try to reboot once it may solve your issue. Also try to clean and rebuild your project.
Just uninstall the app from device. Then rebuild and install
Go to the apps option in settings in your phone and see if the application is still listed there . Search the entire list, it could be on the bottom of the list. Remove from there and then you could install the app from studio.

Android Studio - Can't debug on my Device

I'm facing this issue with multiple devices. And i have no idea how to fix that.
Whenever i try to install an app from Android Studio into my Device i ends up getting this error.
I tested this on Vivo, Mi, and some other devices but i got the same error.
Please lemme know if there's a solution to it. Or at least help to get a basic idea why this is happening to my Android Studio.
My Version of Android studio is v.2.3.1
Try disabling instant run
Settings> Build, Executions,Deployment> Instant Run
There are two chances:
1.USB Debugging off :
Enable Developer Option of your device,
Switch On USB Debugging
2.In Android-Studio : File -> Invalidate Caches / Restart
Clean the project and rebuild the project.

Session 'app' error while installing APK

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

Installation error: Unknown failure

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.

Debugging with Android Studio stuck at "Waiting For Debugger" forever

UPDATE
The supposed duplicate is a question on being stucking in "Waiting For Debugger" when executing Run, while this question is on being stucking in "Waiting For Debugger" when executing Debug, the steps to produce the problem is different, and the solution(s) are different as well.
Whenever I try to use Android Studio's Debug function, the Run status would always stuck at:
Launching application: com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity.
DEVICE SHELL COMMAND: am start -n "com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.astrotek.parashoot.debug/com.astrotek.ptpviewer.StarterActivity }
While the device (Samsung Galaxy S3 Android 4.3) I'm debugging would display
This has being the case from Android Studio 0.8.8 all the way to 1.0. And on the same computer I can perform debugging using Eclipse on the same device without any issues.
So the question is what can I do to make Android Studio debugging work?
Update: The same thing happens when debugging on Nexus 7 (2013) running Android 5.0; and testing on another machine rendered the same result. I can't be the only one encountering this issue :-/
Update: Opened a bounty since this issue is so annoying. Even re-installing the app doesn't solve. Nexus 5 running Cyano, Win7 64. The ADB log is telling:
8568-8568/it.myapp:myprocess W/ActivityThread﹕ Application it.myapp is waiting for the debugger on port 8100...
8568-8568/it.myapp:myprocess I/System.out﹕ Sending WAIT chunk
Also, I can't find an easy way to disconnect nor reset ADB connection in Android Studio.
Obviously is yet another Android Studio, or rather ADB bug.
Just use this command to disable it.
adb shell am clear-debug-app
OR
Ensure there is nothing to wait for, by automatic uninstall from Device before each test-run, using Gradle's uninstallAll task, as mentioned in:
stackoverflow.com/Auto uninstall before install?
On some machines/projects the debugger do not attach automatically so you need to attach it manually (studio menu -> Run -> Attach debugger to Android process)
Restarting Testing device fix the issue for me.
Restarting Android Studio fix the issue for me.
After clicking on the run icon. If it is stuck waiting for a debugger means it is not attached to the app. You have to manually attach by clicking on Attach Debugger to Android process.
It is on the right side of the run icon. I had focus this icon in linked image.
Updated Image for Attach Debugger to Android process Icon
Debugger stopped connecting for me today and nothing worked until I tried the following:
Go to Run, Edit-Configurations, Miscellaneous Tab, uncheck 'skip installation if APK has not changed' Apply, OK.
Debugger started to connect again.
A similar question has been asked recently and the solution may work for some and is very quick.
Clearing the Intellij IDEA (Android Studio) .idea directory which
contains configuration information worked for me:
Exit Android Studio
Navigate to the project you are trying to debug
Backup any files inside .idea that you modified (if your project checks any of these into VCS)
Delete .idea directory
Open the project in Android Studio
This problem occurs when you open more than one instance of Android studio, so you need to attach the debugger manually like mentioned above.
You may need to close other instances of Android studio.
I faced this problem in android studio 3.0. Just restarted device solved.
Both of my dev machines have JDK 8 installed, the debugging function is restored once JDK 7.0.71 was installed and JAVA_HOME environmental variable was set to point to the new JDK.
Guess there's some compatibility issue between Android Studio + ADB + JDK8 (Eclipse + ADB + JDK8 works fine).
I tried the top three rated answers but failed. After rebooting my mobile, the problem is solved. No more long "Waiting for Debugger".
I just managed this problem, after several days of trying the above solutions.
So I closed the emulator, run AVD manager and in device menu choose - "wipe data"
So in next run I was free from stucked debugger.
When the Device displays the message go to Run->Attach debbuger, then select a debbuger. it'll start the activity.
This fixed it for me. Android Studio -> File -> Invalidate Caches & Restart...
I had the same problem. Restart my android phone device worked for me.
This solution works for me:
turning off the USB debugging from my device settings , and then turning it on again.
its Much quicker and easier than restart the device.
How it worked for me.
1 Start Android Device Monitor from Tools -> Android -> Android Device Monitor
2 Click on Stop for the process you are facing the issue from list of devices.
For me, the issue was: The Regional Format of Windows was ARABIC.
I simply changed the regional format to English (United States) and the error has fixed.
Steps to fix:
Go to Start -> type Region -> click on Region to open Region window -> from the Format dropdown, select English (United Stated) -> Click OK.
Restart Android Studio.
As for my case, running Android Studio Canary (preview release) along with the stable version was the problem. Running multiple instances of the same Android Studio flavor was OK, but mixing them often resulted in "Waiting For Debugger".
Most of the times this is caused because of the overload of resources and threads over the emulator. Or even for the lock of objects that GC couldn't set free: http://developer.android.com/intl/pt-br/tools/debugging/index.html
Usually, a single restart of it will solve the issue, but sometimes it asks for the IDE restart, so be sure to make both tests.
Another good test is trying to start the app in "Start mode" and then try the debug mode again...
P.S: Don't forget to kill each debug process in the IDE after each test. This will prevent your env to be more overloaded.
Android studio 3.0 and Above
Disable the instant Run
This also happens to me from time to time. Problem is that your app / device is configured to wait for debugger. In this case it is waiting for debugger before continuing execution of.
Option 1:
Attach debugger or run in debug mode. You can do this in Android Studio. Buttons to attach debugger and run in debug mode are located next to normal run mode (Bug and Bug with arrow).
Option 2:
Disable Wait for debugger. You can do this is developer settings. This option needs to be disabled in:
Root of Developer Options
Developer options -> Select debug app ->
-> Wait for debugger
This was tested on Android emulator in android studio. Other phones might have this setting different. If you can not find app's settings in debug, reinstalling app might work too.
I had the same problem. Restart my android device and closed the adb.exe process. With that I could solve the problem
Well, I guess there is a plethora of circumstances that can trigger this issue. I'm using IntelliJ Idea instead, but it's mostly the same than Android Studio. My solution for this problem:
Fastest way:
Right click on the class file that contains the main activity of your
project, and then on "Debug 'WhateverActivity'". This will create a
new run configuration that should debug fine.
Other solution, without creating a new run configuration:
Open Run/Debug configurations and within "Android app" pick the configuration you're using to debug your app.
Locate "Launch Options/Launch" there and set it to "Specified Activity" instead of "Default Activity".
In the "Launch" field just below the aforementioned option, click on the three ellipsis (three dots) button and select your main
activity.
At least it worked for me. I hope it works for others too.
Got it fixed according this solution: https://youtrack.jetbrains.com/issue/IDEA-166153
I opened <project dir>/.idea/workspace.xml replaced all the
<option name="DEBUGGER_TYPE" value="Auto" /> occurrences to
<option name="DEBUGGER_TYPE" value="Java" />
and restarted Android Studio
Open Command prompt and go to android sdk>platform-tools> adb kill-server
press enter
and again adb start-server
press enter
Non of this solutions worked for me.
In my case was that I was debugging an App from Intellij IDEA and at the same time with Android Studio. By just closing the Intellij IDEA and removing the app I was debugging just fixed my problem.
Make sure that your Active Build Variant is debug.
If you also want to make your release variant APK debuggable then make a simple change in app level build.gradle -
buildTypes {
release {
debuggable true
/*Your rest code*/
}
}
For me the problem was having IntelliJ open at the same time as Android Studio. I was using IntelliJ for back-end development at the same time as Android Studio for app development. Even though I was not doing any mobile device work with IntelliJ, it broke debugging in Android Studio.
Solution: Shutdown IntelliJ when debugging with Android Studio.
Restarting everything didn't work for me. What DID work was waiting for a few minutes while Android Studio unclogged itself. This was the first time I ran the debugger; after that, Android Studio fired up the debugger quickly.

Categories

Resources