I'm building an app in Android Studio. After some time the app stopped reflecting the progress of the building development. I then uninstalled the app from the emulator and it has not installed although build is successful every time. I built the apk for the app and dragged it to the emulator. App is installed but does not start. Is there anything to make it work?
Have done the following:
enabled and disabled Instant Run
enabled and disabled ADB integration
restarted Android Studio added debug{debuggable true} to buildTypes in the app gradle even though it is not advisable
Device Monitor says "ADB rejected shell command (ls -l /)" and "Adb connection Error:EOF"
Thank you
PS:
Android Studio version 3.0.1
Check "minSdkVersion" in App Gradle. if it is less than the Emulator which you have then it will not install or run on it. Make sure "minSdkVersion" should be greater than or equal to Emulator API level.
In Android studio Go to "Build Variant" tab and then change your application build Varian to Debug.
Finally solved it. Thanks to Andy Boot's answer to this question. In short:
I went to Run->Edit Configurations->Android App->app
The Launch droplist had 'Default Activity' selected. I changed that to 'Specified Activity'
I then filled in 'MainActivity' in the Activity field, which has the 'LAUNCHER' intent in the Manifest file.
And that got my app running once again on the emulator ;)
Thanks, everyone.
Do the following if you are facing like Gradle Build finished successfully while running app but app is not installed in Mobile or Android Emulator then follow the steps
In 3rd image 'Deploy' and 'Launch' options should be selected as shown in picture. Apply settings and click OK. YOU DONE.. HAPPY CODING.
I download an android project source code from github and open it with Android Studio, but when I click the "run app" button, after some while I got this error:
Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error).
In order to proceed, you have to uninstall the existing application.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?
And I got this error in the console
$ adb push D:\work\zuoyexitong\third-part-projects\AndroidAudioRecorder\app\build\outputs\apk\app-debug.apk /data/local/tmp/cafe.adriel.androidaudiorecorder.example
$ adb shell pm install -r "/data/local/tmp/cafe.adriel.androidaudiorecorder.example"
pkg: /data/local/tmp/cafe.adriel.androidaudiorecorder.example
Failure [INSTALL_FAILED_DEXOPT]
But I'm sure I didn't install this apk before. And if I click "ok" to let Android Studio to uninstall the app, i got this error
$ adb shell pm uninstall cafe.adriel.androidaudiorecorder.example
Unknown failure (Failure)
Error while Installing APK
My Android Stuido Version is : 2.2.3 .
The project i use is here
My device's android version is 4.1.1 .
My problem looks like this and this , but they can't solve my problem.
So how to solve this problem?
Try turning off Instant Run in Android Studio:
File / Settings / Build, Execution, Deployment / Instant Run / uncheck the top box.
If this allows successful installs, then turn instant run back on, and see if the problem comes back. It did for me - I just hit this issue on a small test program at AS2.4P7. The instant run feature is a light switch -on gives this error (even after refactoring) - off and the app loads OK. If it problem comes back when you turn on instant run again, then file a bug report - Help / Report Instant Run Issue...
This message is because there is an old version of your app installed on the device that has a dex size different from the current one you are trying to install, so you should press OK and proceed!
But I'm sure I didn't install this apk before.
Check if you are using the same package name of another app that is installed on your device [most probably by you]!
check you have space left for app install. Try uninstalling some apps and try this app install.
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.
I recently started learning how to develop android apps. One annoyance I'm facing is that after a successful build of my code, after I modify it and make some changes and save it, the emulator won't load the new code until I close and open the emulator like 2 or 3 times. It says something along the lines of installing blahblahblah.apk in the console, and then after that the new code finally runs on the emulator. Until then, it keeps running the last successful build.
Does anyone know how to either:
Make the emulator install the new apk without requiring that I restart it several times
Make the emulator load faster (I already tried increasing the RAM)
I'm using the version of eclipse that came with the ADT bundle provided by Android.
To make your emulator fast just do following.
download intel-hardware-accelerated-execution-manager. from here.
http://software.intel.com/en-us/articles/intel-hardware-accelerated-execution-manager.
install it in your computer.
after that intel atom system images in android SDK.
after that create new emulator and select intel atom in cpu option.that make ur emulator fast.
Try this ,
Run As > Run Configuration
.. Android > Brows project which you want to Run.
.. Target > Enable "Always Prompt to pick device."
.. Common > Check both "Run & Debug".
And along with that Enable (Check) Wipe User data of your virtual device so that will uninstall older APK and install new one. Because some time emulator use older garbage reference.
Instead of closing and opening the emulator(I know it is time consuming), you can
use the "reset adb" under the devices window
to reset your emulator(it is a matter of seconds.)
Steps to speed up emulator (atleast to a small extend):
Increase your emulator ram size. Use a small screen sized
emulator.(Makes the rendering process on arm faster).
You can clear cache/data per application from settings (Applications -> manage applications). This of course only clears data that your application is creating. You can also uninstall your application from there which will cause everything to be cleared. Then you can run your application without starting emulator again.
firstly go to project->
select build automatically
if it is not working then
open the command prmt and go to the path of your sdk like-
E:\param\android-sdk\android-sdk\platform-tools
write commnd adb kill-server
then again write command adb start-server
this will help you
Is there a way I can just update the apk file after making changes to the android source file in eclipse. I want to be able to do this without actually pressing the Run button in eclipse.
The reason I want this is because - I usually keep the emulator open in the background (since booting it up everytime takes too much time on my slow computer). And when I run the program after a previous run, eclipse just seems to hang up - even after I have stopped the app in the emulator.
So I decided to use the adb install command-line program to install on the emulator, but am unable to get the apk file updated without actually pressing on the run button in eclipse.
Actually, the Eclipse ADT plugin works like you want it to work. Everybody just run emulator once and then pressing RUN button update the application. If you have problems with this post the logcat during the run of your application.
You always can check the Build Automatically option in the Project menu option in Eclipse. Or you can Project->Clean your code, sometimes Eclipse get stuck trying to refresh all projects and dependencies.
You can un-install apk package with command line----
in linux os example:- adb shell pm uninstall -k <package name>
You can leave -k if you don't want to delete data and cache. If this command is failed then use emulator;
open settings in emulator -> apps -> your app and then stop it or un-install with emulator and it is more easy. Options are depend on emulator device.