When I run my app from AndroidStudio 0.4.3 using Run I see Choose Device which has two sections choose a running device or Launch Emulator. I don't have a running emulator at the moment so I click the ... to launch AVD manager and start an emulator. At this point I see that under choose a running device the emulator I just launched shows up but its listed as offline.
In the past the offline status went away when the emulator was fully up and running. However, now I've noticed that when the emulator is launched fully, it no longer appears in choose a running device.
I feel like I'm always playing cat and mouse game with android studio picking up the emulator. Is there a better way to do this? Am I missing something?
Disable and then Enable ADB Integration
In Android Studio go to
Menu -> Tools
Android
Enable ADB Integration (should be checked, click to remove check)
Enable ADB Integration (should not be checked, click to add check)
Run your app again. Emulator that was previously missing from Run dialog should be available to be selected upon which to run your app.
Try to kill the adb server and restart it.
Locate your adb binary (linux/osx) or adb.exe (windows) and do:
adb kill-server
adb start-server
this should fix your problem
Even if your problem still not solved then Restart emulator.
Wipe Data and restarting emulator helped me, hope this helps to someone.
inside AVD manager, select your virtual devices, then 1 stop, 2 wipe user data, 3 cold reboot, works for me.
On Windows, running Android Studio with administrator permissions can help (in addition to restarting adb server).
Unchecking the "Enable ADB " worked for me
In Android Studio Arctic Fox (2020.3.1) it helped me to cold boot the device.
add -port 5037 on ../[some_emulator]/emu-launch-params.txt file & try again...
like image
Related
I'm working on a project for my Android class using the latest version of Android Studio (3.4.1) and my app isn't working right. I can't see what's going wrong because nothing shows up in the Logcat.
I'm running my app on a physical phone since Android Studio doesn't like AMD. I have "Show only selected application" selected and it shows my phone is connected. I tried restarting Logcat, but that didn't do anything.
screenshot to show my issue
Just try ,Invalidate and Restart Android Studio or Restart Android Studio.
Keep the device connected. Open terminal from below. Type following command to kill and start adb.
adb kill-server && sudo adb start-server
If the command doesn't work, you will need to fire it from /sdk/platform tools/
I am having a slight issue when trying to debug and android app via usb to external device. I keep getting the error "Warning: debug info can be unavailable. Please close other application using ADB: Monitor, DDMS, Eclipse
Restart ADB integration and try again
Waiting for process:"
I have tried stopping adb.exe in task manager , closing android studio and restarting , taking out the cable and putting it back and going to tools => android uncheck adb intergration then recheck it . All to no avail
This is a problem of ADB connections as sometimes ADB cache a dead connection on your real/virtual device and due to which the port is busy and u cannot connect to it.
The simplest solution to this is RESTART your ANDROID phone that's it.
What worked for me was to disable and re-enable USB debugging on the device.
Following steps resolved this issue to me:
Disconnect the device.
Restart android studio.
Run the project.
Simply go to your Android phone developer settings, disable USB debugging, delete all authorizations for USB debugging and turn the debugging on again.
First make sure you close any application use ADB , DDMS
like if you open Eclipse with android studio
Second restart your ADB from terminal
adb kill-server
adb start-server
The issue occurs when I open the Android Studio and IDEA together.
Restart the Android Studio does NOT fix the issue
Re-plugin the cable either does NOT fix the issue
Restart the Mac either does NOT fix the issue
Restart the ADB from terminal FIX the issue
adb kill-server
adb start-server
In this way, you do not need to close the IDEA.
Updated: 2022-09-19
Restart the Android Studio does NOT fix the issue
Invalidate and Restart the Android Studio does NOT fix the issue
Re-plugin the cable either does NOT fix the issue
Restart the Mac either does NOT fix the issue
Restart the ADB from terminal either does NOT fix the issue
Restart the Android device fix the issue.
This problem sometimes occur when Android Studio is opened with another IntelliJ Editor. Just close the other IntelliJ Editor.
Open USB preferences in your device. Like the image below.
Click another option. (eg:File Transfer)
Click the no data transfer.
If it doesn't work,please try again.
The operations on the android devices are similar.
this may happen when you created two instances of android studio, or else you are using same device in multiple ADB programs, so simply disconnect you device and then open your desired android studio instance and then connect again. now it will work fine.
i also use same method and every time it works.
IntelliJ IDEA (Ultimate, probably also Community) comes with Android plugin. If IntelliJ is started and any project is open and has been compiled (even without any Android code-base) then IntelliJ (apparently) steals the adb-connection from Android Studio. Either close IntelliJ or disable the Android plugin in IntelliJ.
If IntelliJ is open with android plugin, rebooting phone, killing adb etc. are only sporadic and short-time fixes of the problem as IntelliJ steals the adb connection again.
I resolved this issue by changing the Use USB for settings
Go to setting select transfer settings in my case MIDI was selected.
Go to Airplane mode ON and OFF , After that everything back to normal.
In my case, I had my device connected both via WiFi (with adb tcpip) and USB cable. Disconnecting the USB cable solved the issue.
Quite awkward issue, I think none of the solutions mentioned above worked for me.
Ultimately, I had to invalidate caches and restart.
File -> Invalidate caches... -> Select both options -> Invalidate and restart
For me was Eclipse using DDMS and conflicting with Android Studio, I wasn't using, so I just uninstall it.
If is your case, go to Eclipse > Help > About Eclipse IDE > Installation Details > Select DDMS and Uninstall..
At times ADB caches a dead connection on device(real / virtual) due to which the port is busy and it is unable to establish a connection.
You can try different ways:
You can kill and restart the server:
adb kill-server
adb start-server
2). Try disconnecting the device(phone) and reconnecting it.
3). Restart your device (phone).
Slightly different answer, but I'm including it for completeness.
For me Android Studio had frozen as well with the spinning beach ball of death.
I rebooted the emulator (by having it emulate a power-off/restart cycle)
Killed Android Studio (on a Mac by using ⌘⌥esc)
Restarted Android Studio.
After that everything was back to normal.
if you open two Android Studio at the same time (android studio preview),Will be like this
A possible temporary work around that may work prove useful for progress sake when intending to debug is to run the app in android studio , then immediately click on run => attach to debugger
I previously developed on Eclipse and just migrated to Android Studio.
Everything works fine, it's better and faster.
I work on real device, and Android Studio recognizes it without issue.
But when I disconnect and reconnect my device, it doesn't recognize my device anymore, I have to exit and restart Android Studio.
I can't find a way to "Reset adb" like Eclipse Feature.
Can ADB be restarted from within Android Studio? If so, how?
What I usually do when I get this error is restarting the adb server by typing in the command into Terminal:
adb kill-server
adb start-server
However this can be achieved in Android Studio. Clicking the Monitor button you can launch the same program you have referenced from Eclipse.
If you do not see this you may need to update your Platform Tools from the SDK Manager button.
Apart from the above working answer, the ADB can also be restarted during the restart of Android Studio ( File > Invalidate Cache / Restart > Just Restart ).
ADB is down for a reason, therefore a clean restart of Android Studio is suggested.
that did trick for me thanks. resetting adb on android studio fixed my issue of ADB not responding. If you'd like to retry, then please manually kill "adb.exe" and click 'Restart'. spent 2 days trying look for solution to this
While installing the android application in the emulator I am getting the following error.
Please help me to resolve this error.
Error message:
emulator.exe -avd avd_name
adb wait-for-device
adb install path-to.apk
could not access the package manager. is the system running while installing android application....
You need to wait for the emulator to full start - takes a few minutes. Once it is fully started (UI on the emulator will change), it should work.
You will need to restart the app after the emulator is running and choose the running emulator when prompted.
As other have said, this error occurs because the emulator is still in the process of launching. An attempt to access the package manager, for the device, at this time causes an error.
It's just a simple timing issue. Here are the steps to avoid this error:
Wait until the emulator 'lock screen' is showing.
Run the 'app' again (^R in most IDE's).
Choose the running device (Should be the same emulator).
App should install without error.
In my case it was just that the emulator took 9 minutes to start. Wait until you see the lock icon on the emulator LCD. Or use actual tablet or phone.
Facing Same issues following Link helped solving the problem. The above solutions were not helpful for me.
deployment-failed-could-not-access-the-package-manager-is-the-system-running
By restarting server using CMD application was back to work. Open cmd (Run as administrator), open this
cd C:\Program Files (x86)\Android\android-sdk\platform-tools
(this path must specify your android-sdk installation folder )
Now, first write,
adb kill-server and then adb start-server.
Kill the process/server and restart it.! It worked.
You can avoid the error by setting default device before launching application. Launch the AVD before starting the app.
Once you see this error, wait for emulator to show lock screen. And then relaunch the app in your IDE and check the emulator again. It works for me always.
In Android studio, you can relaunch by clicking the green play button or ctrl + r.
If this error is gotten when using a rooted device's su prompt and not from emulator, disable SELinux first
setenforce 0
You may need to switch to shell user first for some pm operations
su shell
then re-run your pm command.
Same applies to am commands unavailable from su prompt.
The solution for me was to restart the IDE. I suspect that a slow emulator was hiding from view, blocking installation on my device.
Check your project build is in Debug mode not Release, I had some problem for debugging always I forget to change Release mode to Debug (Xamarin Users)
The emulator starts up fine. But when you long-press the power button (or F7) and choose "Power off", it displays a "Shutting down" message which remains on-screen forever and the emulator won't actually shut down.
I can close the emulator window or kill its process. But I'm wondering if this is the correct way to shut down an Android emulator.
According to the documentation I found at google, simply closing the
emulator window is the correct way to shut the emulator down.
To stop an emulator instance, just close the emulator's window.
Source: Starting and Stopping the Emulator
Open Android Studio
Go AVD Manager
Go Actions Tab
Click arrow
You will see stop
Click and emulator shut down :)
If the device is stopped in a bad state, this may persist when relaunching the emulator. To get around this, simply select 'Cold Boot Now' from the virtual device's drop down menu in the manager.
I'm running Android Studio Chipmunk 2021.2.1 and most of the solutions in this thread no longer work.
adb solution
What does work is using adb to shutdown the emulated device:
adb reboot -p
(The -p stands for power off, so it's not really a "reboot")
If you have multiple devices attached you'll need to specify which one:
adb -s DEVICE_SERIAL reboot -p
(You can find the list of device serial numbers by running adb devices)
Alternate pkill solution
Shutting down via adb is the clean way to shutdown the device. If for some reason that doesn't work, you can kill the emulator by running:
pkill qemu
This will kill every running instance of QEMU on your computer (QEMU is what the Android Emulator uses under-the-hood). pkill(1) is installed on most computers, but you may have to install it if it's not built-in.
Okay so do this:
Open Android Studio
2.Go to AVD Manager
3.Select Your Emulator and Cold Boot Now
On Mac, you can simply use the shortcut Cmd + w to close the emulator window (either window or docked mode). It would automatically shut down the emulator.
I've verified this for Android Studio Bumblebee | 2021.1.1 Patch 3
Open Virtual Device Manager, locate the virtual device you are concerning, check "Cold Boot Now" on the drop down menu of actions column of it.
This is for Mac Users.
Click on android emulator.
Go to top menu
Click on item which is shown (there will only be one)
Click on Stop/Quit from the dropdown.
It will then save its present state and then it will shut down.
No idea
I really don't know.
Here's what I do know.
Getting a list of running Android instances
You can get a list of running Android instances by entering this command:
adb devices
What else you can try
Now you can visit "How I shutdown Android phone with adb command?" and try all the proposed solutions.
I don't know whether any of them work. Please leave a comment below and inform us.
More thoughts
You can connect to a running emulator by entering this command:
adb shell
Now you can enter Unix-like shell commands which will do things. These are similar to the usual Linux shell commands.
Maybe the following will work? But, does it truly shut down, or does it reboot?
sync && reboot -p
In fact, does any "shut down" command work, or do they all just cause the running Android instance to reboot?
Please file a bug report
Someone should file a bug report, in the Android issue tracker, against the current version of the Android emulator — plus one of Google's newest available emulator ROMs. Once you do so, please leave a comment below and provide us with a link to the bug report.
If you were taking advantage of the emulator's "snapshot" feature, you probably didn't need to shut Android down in the first place.
If the feature is enabled, closing the emulator window should hibernate the emulator's state to disk. (Source.) This should make the emulator start up quicker next time.
You can enable snapshot support using AVD Manager's "Edit..." button.
If you want to enable snapshot support, you'll probably need to disable the "Use Host GPU" feature. I believe that the two features are mutually incompatible.
I tried to hold click on right side button for 3-5 seconds and choose to turn it off. It works for me.
Found an easy solution: from android device manager-> when having emulator in question highlighted, click on ... (three dots) on top right-> select Start with factory defaults.
Goto AVD manager (Tools menu > AVD Manager), in the actions section, stop and then wipe data
Now click play button in the same window
AVD is running on port 5555, the easiest way to close it is using the below command line:
sudo lsof -n -i :5555
It will show the PID that is running your AVD, use -9 or -15 to kill the process
kill -9 [PID]
On Windows 11, the emulator often refuses to shutdown, and just stays frozen. Killing the qemu-system process in Task Manager while AndroidStudio is running resolves the issue.
if you are using last version at Android Studio.
Deleted this file.
snapshot.lock.lock
multiinstance.lock
hardware-qemu.uni.loc
from
.android/avd/Pixel_3a_API_29.avd