How do I stop app in Android Studio - android-studio

I must be missing something totally obvious, but I can't find a simple way to simply stop an app from running. I'm running it on my HTC One.
I first tried toggling the green run arrow. Didn't work.
I found a "Terminate Application" circle in the lower left of the window. That doesn't seem to do anything when you click it. It seems to be grayed out, non-functional. Screen shot here
http://www.screencast.com/t/VLTOzPQ7
So, I closed the entire project. That worked, but also the entire Android Studio closed instantly. Then reopening Android Studio failed (stack dump). Then reopening again worked, but it took 30 minutes to load my project.
To stop the next time, I turned my phone off, then closed the project. That seems to have worked better, since it took me to the Welcome to Android Studio screen and invited me to open or start a project.
Maybe there's an easier way to stop an app? I see the same question on this forum but no solutions.

The Android Studio controls you are trying to use only work if you are running your app in the emulator. There are a few ways to do this when you are using an actual device or VM (e.g., Genymotion):
Use the UI of the phone to Force Stop the application. This is done in the Settings->Apps menu.
Use Android Studio's terminal window or the host's shell and issue the command:
adb shell am force-stop <package-name>
Open Android Device Monitor (green "Droid" icon), select the process under the Devices tab and click the Stop Process button (stop sign icon). This is basically the GUI way of doing #2.

You need to select the process you want to terminate (ex. com.myname.myapp) then click terminate application.

Since the application is running on your phone, you need to end the application process on the phone. When you do that the application would be shown as terminated on Android Studio.

Related

How can I find out why Android Auto in developer mode won't connect to the "Desktop Head Unit"?

I am attempting to get car_app_library hello world example to run through android auto to the DHU.
I have two different workstations with Android Studio and the DHU 2.0Beta. I have two different Android Devices, a Galaxy S9+ and a Galaxy Tab S6.
With any combination, with ADB and DHU running, locally on the devices at best, I can get a full white screen to flash which disappears, and no connection from there.
On the device, I have enabled unknown sources in Android Auto, and I have started "Head Unit Server"
On the workstation, DHU simply indicates at all times, "Waiting for phone...".
Studio "Run" indicates "success, operation succeeded" but nothing happens.
I finally got this working after two days. I could tell when it was not working that 1/5 times I'd see a flashed screen prompting for bluetooth and to continue, but I could not click any buttons in time.
Finally,
I uninstalled the "Android Auto for phones" application on the device, and I think this was the real solution
I also moved to canary channel for studio, and then needed to uninstall and reinstall the desktop head unit.
After this, I could get the screen to show that I saw flashing before, and I had to accept it once, then it crashed again, then I started it all again, and it is finally working.

Android Emulator got stuck at "shutting down"

The emulator in my android studio keeps showing "shutting down". I try closing it and run again, restarting my mac, but nothing worked, each time I run it, it shows "shutting down" again. even though I can see actions running below (very blur)
Click on Tools
Click on AVD Manager
Click on the dropdown arrow next to the AVD which is stuck
Click on cold boot now
This issue occurs when we forcibly exit an unresponsive/stuck AVD. AVD manager saves the state before it is forcibly exited and on the next start it continues from the unresponsive/stuck state. This is useful when we need the AVD to boot up quickly, however if you want to disable this feature entirely then follow the steps below:
In the AVD manager, click on the pencil icon
A new window will pop up. Click on show advanced settings
Scroll down to the emulated performance section
Next to boot option, select cold boot
open AVD Manager Dialog from top right corner
go to your emulator
click on the last icon on the right which is a drop down button
Click wipe data
Important Note: this will delete all data on that emulator and give it a fresh install again and might solve your problem
If that didn't work then check that you have enough rams to run both the emulator and the android studio.
I run my emulator with cold boot by command line
cd C:\Users\<your_user_name>\AppData\Local\Android\Sdk\emulator
emulator -list-avds
emulator -avd <your_adb_name> -no-snapshot-load
If the cold boot or wipe data does not work, you can try deleting the lock file. Then quit the emulator, and restart it.
In my case, AVD Manager prompted me to delete the following files, I did it, and the problem was solved.
If it shows "AVD *** is already running etc." then just connect any mobile device that after enabling debugging mode and run your app in a physical device instead of an emulator then
Click on Tools
Click on AVD Manager
Click on the dropdown arrow next to the AVD which is stuck
Click on cold boot now
First of all:
You have to close the window, or tab of your Virtual Appliance.
With this you get Android Studio to standby the Device and unlock the ADV (Android Virtual Device) files, so you can manipulate the virtualization.
Maybe you have to wait until Android Studio kill the process. If Android doesn't do this automatic, you will have to close Android Studio and delete C:\Users{YOUR_USER}.android\avd{YOUR_DEVICE_NAME}.avd and within this folder delete all files and folders with extension .lock to stay secure before start again Android Studio.
After that:
Just open the Device Manager, and click on the down arrow in the Actions section for your device, and select Cold Boot Now. This reload the Virtual Device without start or open any program.
Finally:
If Cold Boot Now worked fine, now you can run or debug your application to check that it functions perfectly. Without the device continuing with the problem that the system is still stuck/frozen.
And also you do not need to do a Wipe Data, so you do not delete the data of your application, since you can have any internal database in SQLite, which has the changes and advances that you have been implementing or creating during the development of your application for its operation.

Can't seem to find DDMS in Android Studio 2.1.2

Not sure what I'm doing wrong here.
My basic goal is that I'd like to be able to take screenshots of my Android tablet via Android Studio which is running on my Windows laptop.
I gather I need Dalvik Debug Monitor Server (DDMS) to do this, however I'm struggling to find it within Android Studio.
All the guides I've read so far mention that you simply click on the DDMS menu button in the toolbar. This seems to appear like a green android robot.
Well, I have the android robot and so I click on that. The tooltip for the button says 'Android Device Monitor', nothing to do with DDMS.
And then normally says 'Android Monitor is already running' and does nothing. But all I have on my screen is Logcat and Monitors tab. I can't see the same stuff that I usually see on DDMS screenshots.
Occasionally it will throw an error which appears in the log files (but too big to post here)
How can I fix this?
Ok, officially dumb.
The DDMS was opening up in the background of another monitor.
Carry on...

Hololens emulator mouse input not captured

In Hololens Emulator with Windows 10 Pro, I can only use keyboard strokes and my mouse is not recognized. How can I turn on mouse input? I did nothing to connect my keyboard, so why is it with a mouse that I have to change something?
One problem that may solve it: make sure when using the emulator that in Package.appxmanifest in Visual Studio the MaxVersionTested line is the correct version. I was looking at an older version which everyone says to use: 10.0.10586.0 which was incorrect. When choosing the device for debugging, the version will be in the name. Currently, the most updated version (that I am using) is 10.0.14342.1018. After that, start debugging and run the emulator and you should have keyboard and mouse input!
I had the same problem, but I'm not sure how I solved it. Here is what I have done:
Installed Update 3 for VS 2015. Tried again without restarting the PC and got the same problem. On the next day I started the HoloLens Emulator directly via Hyper-V Manager. After that I started my project in Visual Studio. The Emulator loaded correctly and now the Human Input and Keyboard and Mouse Input buttons are enabled.
Update: That was definitely not the answer, but I found a working solution here:
http://forums.hololens.com/discussion/952/no-input-from-emulator
Just put off your proxy in IE and the icons will be enabled. I could turn my proxy on again and the controls remained active.

Android Studio won't run application from studio ide?

I've got an application I've been working on and am having an issue with android studio. When I click "build->run" and then select my device, the application never runs on my phone (and the log in android-studio that automatically comes up does not have anything, whereas in the past when I have used this feature it usually says something like, "waiting for phone..." and then the application pops up and automatically opens on the phone and you get some other pertinent information). I have the phone already in developer mode with the install from unknown sources set to on. When I manually move the application from its gradle build location to the phone and then install it manually in file explorer, all is well and the application performs as expected. As I need to debug, however, this is not a very viable solution. Anybody have any advice as to how to get it to run from the IDE? I have tried rebuilding and invalidating the cache/restarting android studio, to no avail.
When I click the run tab at the bottom I have an empty window. When I click the debug tab, I see:
Waiting for device.
Target device: samsung-samsung_sm_g920a-randomIntegerId
Uploading file
local path: /home/eric/Documents/class/OOSE/final_project/2015-group-17/project_code/android/Place2B/app/build/outputs/apk/app-debug.apk
remote path: /data/local/tmp/oose2017.myApp
Note: I am building the application on a LUbuntu 15.04 VM on a windows 8 host, and am using the latest version of android studio.
EDIT: gradle console indicates a successful build as well (obviously since moving the .apk manually to the device works properly).
Open 'Run->Edit Configurations...', and look for your app module in the column on the left-hand side.
Select it, then go to the 'General' tab.
Under the 'Activity' section, there are a couple of radio buttons. Make sure that 'Launch default activity' is selected.

Resources