Constantly getting ...DeviceMonitor] Failed to start monitoring - android

I find that after running or debugging my application a few times using eclipse, that I get the above output in my console (in red) and I get no feedback from Dalvik as to the connection status to my phone is going. My application will still debug etc. I just get nothing useful in my Console.
Any ideas how to fix this? It appears intermittent. It starts doing it after a few minutes, continues to do it for quite a while and occasionally goes away again. This has happened on my last laptop and now on my new laptop with a completely fresh install etc.

I'm on Windows 7 64 bit; but maybe 2 or 3 times during the day I get this same error. I tried the reboot thing, which sometimes worked, sometimes didn't.
I have found the fix to be:
Close Eclipse
Unplug USB
Open task manager and find the "adb.exe *32" and End Task
Open Eclipse (not done yet)
"Clean All" (not just project)
Then build the project (for me, just building the project works)
Plug USB back in and there ya go!
Always works for me. If anyone knows of an update to something I can download to avoid doing this all the time, I'd love to know!

I had the same problem -
Try to use a different USB port.
From my experience, the USB connections on the PC front are not recommended.

Year almost 2018 I just had same problem which doubled my gray hairs. It turned out my test phone Samsung Galaxy S6 does not like the USB ports on my Apple Thunderbolt Display. I just plugged the USB cable directly to my Mac Pro and it worked right away. Funny thing is my Google Pixel Phone never complains about the USB port on Thunderbolt.

To keep the error message from showing up I did the following on Eclipse 3.7:
Window->Preferences
On the left side tree select Android->DDMS
In the DDMS settings window choose logging level "Assert"
Click "Apply"

You may have to kill the deamon and restart it. Following are the steps;
open a command prompt and locate the SDK's platform tools folder. E.g.:- cd c:\android-sdk-windows\platform-tools
then execute "adb kill-server" command. You will see the disconnected icon in run configuration panel is now cleared.
then again execute "adb start-server" command.
Then try running the device, if it doesn't work try restarting the eclipse.

restart your dev machine, worked for me :)

I was using a USB 3.0 port too and a device Xoom with ics 4.0.
To solve my problem, I needed to restart my Windows, because in the DDMS my device was showed twice.
After the restart, I needed to change the USB port to a 2.0 USB port and it work for me.

problem causes bay USB bug
1- save your work
2- Close Eclipse
3- restart your computer
4- Open Eclipse and enjoy ^^
it works for me
good luck

Related

Android emulator not able to access the internet

I know that similar questions have been asked before, but my problem is new only after installing Android Studio 2.3, the latest version in March 2017. I have several years experience developing Android applications, and I have never encountered this problem before. After upgrading to version 2.3 of Android Studio, my emulator is no longer able to access the internet. I even uninstalled/reinstalled Android Studio 2.3 from scratch and created a new emulator, and I am still getting the same error. This is not an app problem. I can't even access the internet from Chrome, and I wasn't having this problem last week. The message that I get says that the server DNS address could not be found -- DNS_PROBE_FINISHED_BAD_CONFIG. The only thing that has changed on my computer in the last week is the new version of Android plus possibly updates to Windows 10. And yes, my computer has access to the internet. Below is an image of my emulator when I try to use Chrome to search for "Google".
1st try "Cold booting" the emulator as suggested here.
If cold booting doesn't work, try changing the DNS address of your network to 8.8.8.8 (Google's DNS) or another of your preference:
MacOSX:
Open "System Preferences"
Click on "Network"
Select the network which your computer is connected and click on "Advanced"
Select "DNS", Select the "+" button, type "8.8.8.8" (Google's DNS) or if you prefer OpenDNS, "208.67.222.222"
Select "Ok" and "Apply"
Windows & Linux:
https://developers.google.com/speed/public-dns/docs/using
After that close the emulator and start it again.
After trying many of these solutions, I was going to just delete my current AVD and make it again, but when I clicked the down arrow on the AVD, I noticed "Cold Boot Now".
On a whim I tried that. Lo and behold my emulator has internet connectivity again!
Command-line approach
In case you start Emulator through command, pass -no-snapshot-load option, like:
%ANDROID_HOME%/emulator/emulator.exe -netdelay none -netspeed full -no-snapshot-load -avd Pixel_2_API_28
Or for MacOSX:
$ANDROID_HOME/emulator/emulator -netdelay none -netspeed full -no-snapshot-load -avd Pixel_2_API_28
Note that you may need to change -avd Pixel_2_API_28 part (with your own Virtual-Device name).
Also, most tools use ANDROID_HOME environment-variable name, hence define that (if not already), but nowadays ANDROID_ROOT is yet another naming-option.
Decision (edit)
Ok, for those saying why not just wipe data and restart.
Do you reformat your PC every time you restart it? Wiping data on the emulator is just like doing a factory reset to a phone or reformatting your hard drive on your PC and reinstalling your OS. It is unnecessary unless the data is totally corrupt.
When you shut off the emulator and restart it, it is like putting your PC in hibernate or sleep mode. Memory is not wiped, it is saved.
Doing a cold boot is the same as rebooting your phone or rebooting your PC. It resets memory and lets things reload. This allows the network emulation to start with clean memory and connect properly.
So, don't wipe your data. Just cold boot. If it still doesn't work, then wipe, but save that as a last resort.
I found a temporary solution on an old Stack Overflow thread at Upgraded to SDK 2.3 - now no emulators have connectivity. Note that this thread talks about Android SDK 2.3, not Android Studio 2.3. The problem seems to be that the emulator can't find the DNS my computer is currently using, and the temporary workaround is to start the emulator from the command line and specify the DNS server. Whatever problem occurred back then must have reappeared in the latest version of Android Studio.
The temporary solution outlined below fixes the problem with the emulator accessing the internet. However, it does not fix the problem that occurs when trying to run Android Device Monitor. Doing so will still make the emulator go offline as described above.
Note that there are two files named "emulator.exe" in the sdk -- one under sdk\tools and another under sdk\emulator. Either might work below, but I use the one under sdk\emulator.
The first step is to find where the SDK is located. Assuming a user name of "jdoe" and a default installation of Android Studio on Windows, the SDK is most likely in
C:\Users\jdoe\AppData\Local\Android\sdk
The second step is to determine the name of the AVD (emulator) that you want to run. The command
C:\Users\jdoe\AppData\Local\Android\sdk\emulator\emulator.exe -list-avds
will show the names of your AVDs. On my computer, it shows only one, Nexus_5X_API_25.
To start the emulator from the command line with a specified DNS server, use something like the following:
C:\Users\jdoe\AppData\Local\Android\sdk\emulator\emulator.exe -avd Nexus_5X_API_25 -dns-server 8.8.8.8
In this case, 8.8.8.8 is a Google public domain name server.
The above commands can be shortened if you create appropriate environment variables and edit your PATH environment variable, but I recommend caution when doing so.
[UPDATE 2022] for Mac Users
For NOT Apple Silicon users
System Preferences
Network
WiFi > Select Advanced
From Advanced Choose DNS tab
Add DNS Server 8.8.8.8
Emulator must be restarted after DNS Server has been added (Thanks to #kapusch)
For Apple Silicon users
as per #bourdier-jonathan
You can fix the Silicon issue here:
Emulator appearing offline on M1 Mac after the last update of arm64-v8a
By replacing the AVD system images you have downloaded with the r02 images. Because It appears r03, r04, and r05 all don't work on m1
Updating my WIFI adapter to resolve DNS on 8.8.8.8 solved the issue for me. It started to happen after an Apple update which messed up the DNS address.
Simply open the AVD Manager and wipe the data of that emulator works for me.
Open Android emulator and go to the Extended Controls. Then go to the setting => proxy(Tab), uncheck "Use Android studio HTTP proxy setting" and click "Apply".
macOS: long Story short.. make sure your DNS settings 8.8.8.8 is the first in line, wipe your data and do a cold boot.
Reminder: the Android Emulator internet connection does not work if you turn on a VPN system on you computer.
I experienced this same issue after upgrade. Upon opening the Chrome browser in the emulator, google.com could no longer be reached.
I found a post on SO that suggested the problem was with the emulator trying to use a disconnected network adapter. For me the problem was occurring when I was connected to a LAN. Disabling the wireless LAN adapter fixed the issue.
To disable the adapter:
Navigate to Network connections
Find the adapter
Right click and choose disable
I've resolved wiping data from AVD Manager
This happend to me when the emulator froze and I had to kill the process. The signal icon always showed the small "x" as in the screenshot and no internet connection was successful.
The only thing that helped was uninstalling and reinstalling the emulator (not the AVD images)
In Android Studio:
Tools-> Android -> SDK Manager
Uncheck "Android Emulator" and let it uninstall then check again and let it install again.
I am also facing the same problem, but I am trying to solve the problem using various posts. Today I discovered this problem. Your computer configuration is most likely the problemm, not Android Studio and the Android Emulator.
The problem is coming from your Network setup. Just set the Primary DNS Server to 8.8.8.8, which will solve the problem.
I got a simple and permanent solution for this issue in windows.
Go to network and internet option->
click on Etherenet or wifi(for which you are connected) option ->
Click on change adapter option ->
Right click on the network for which you have connected.
A dialog box will be opened and just click on Internet protocal version (TCP/IPv4) option.
Another dialog box will be opened and there just neglect the first set about the IP address (Keep as it is set) and click radio button of Use the following DNS server addresses: and enter as 8.8.8.8 in Preferred DNS server: and 8.8.4.4 in Alternate DNS server:
Now you can open your emulator whenever and you will get internet in the android emulators.
For me the problem was caused when I took my laptop home without restarting the emulator. From what I have read, when the emulator starts up it reads your PC's DNS settings and uses them. When I was on my home network, my work DNS settings were failing.
So yeah. Just restarting the emulator solved my problem.
This was a problem for me last time the emulator updated itself and back then disabling other network adapters fixed it. Now it's cropped up again but the only adapter that is enabled is a single wifi one so I have nothing to disable.
The issue only reappeared after I updated via a prompt the emulator tools to 26.1.1. I uninstalled and reinstalled the emulator via the SDK Tools update tab and thankfully the only option when installing again right now is to install 26.0.3 (which seems to be working okay).
Moral of the story is to be very wary of emulator updates.
I faced this problem after i kept my emulator ON while going from my home to a cafe. "Cold Boot Now" fixed the issue.
After 10 days of trouble, I just deleted everything from C:\Android\.android\ and deleted all created AVDs. Now internet seems to work fine.
closing the emulator and reopening worked for me
OS
WINDOWS 10
Just goto AVD manager and Cold Boot Now worked for me
I can make it work after turn off and turn on the wifi on android config
Please go through the below link.
https://developer.android.com/studio/run/emulator-networking
Emulator open, click More ..., and then click Settings and Proxy. From here, you can define your own HTTP proxy settings.
Enter the hostname by following
Run > cmd > hostname
Finally, check the internet access inside the emulator by browsing in chrome or google.
Note: Often wipe data will clear the issue. Please follow all steps
I am on android studio 3.1 and it happened.
Solved it by restarting the adb server
$ adb kill-server
$ adb start-server
Hope it helps. Thank you
There was a problem for me too, by disabling the proxy in Android Studio settings, and run the emulator with "Cold Boot Now", the problem was resolved.
Solution for MacOS that does not use a custom DNS for your whole machine
Step 1
Locate the emulator executable Android Studio is using inside the Android SDK and rename it to emulator-original.
Mine is located /usr/local/share/android-sdk/emulator/emulator but it might vary based on individual setups.
Step 2
Add a new file called emulator in the place of the original file containing the following command (or using your DNS server of choice).
#!/bin/bash
$0-original "$#" -dns-server 8.8.8.8
Step 3
Make the new emulator file executable.
chmod +x emulator
Step 4
Restart the emulator using Android Studio.
if android browser can access internet
you can run emulator from terminal
by this command
go to SDK path then
$ /tools/emulator -avd
Nexus_5X_API_23 -netdelay none -netspeed full
it solve your internet problem...
I was having the same issue and i resolved with below steps:-
Go to emulator setting and then go to
setting->Proxy->Either configure it Manually or use Tick use Android Studio HTTP proxy simulator.
please vote, if this works for you
Try these steps once, they worked for me:
Disconnect your PC from the internet
Close the emulator while you are still disconnected
Again connect to the internet
Finally start your emulator again
Just recreating the emulator with another target API worked for me
Maybe you set a proxy for Android Studio and the proxy does not work. Try without proxy.

How to resolve "Warning: debug info can be unavailable. Please close other application using ADB: Restart ADB integration and try again"

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

Android adb stop working

Until yesterday everything was working perfect until today that I connected my phone (just updated to Jelly Bean) and adb.exe stop working. If I execute adb.exe I can see the help but when I want to use any command it just run forever and no message is shown.
I tried with "kill-server" and "devices" and it runs forever, no message at all is displayed and I must terminate the process to close it.
I just connect the same phone to other PC that was fully functional and also adb.exe stop working. The strange thing is that adb.exe will not work any more even If I disconnect the phone and/or I connect my tablet. Adb.exe just got useless.
I was using the same phone yesterday (android 4.0), with my tablet (android 4.2) and adb.exe was working.
Adb.exe is not corrupted as I checked it MD5 and it is the same as in working pc (5787e5df1a68e7afea82d58e5f0d6549 *adb.exe).
I have Android Debug Bridge version 1.0.31 and Android SDK tools 22. I uninstalled android sdk tools and Installed again but when is near to finish it hangs because it launches adb.exe and again it will run forever.
Please any suggestion or help?
Try rebooting. Sometimes the USB drivers lock up. I work HEAVILY with ADB in my project at http://android-casual.googlecode.com and I find it to be one of three things when ADB locks up.. 1. USB drivers, or 2. adb_usb.ini needs an update, or 3. on new devices you have to "pair" them so that ADB can perform any action.
To pair, you can disconnect, reconnect and run "adb devies" to display the pairing on the device.
Not sure if you're still facing this issue, but for what it's worth I had the same kind of issue with adb.exe, and came across this post while trying to troubleshoot it. In my case, I wasn't using any physical Android devices, only the Emulator. Everything had been working fine and then suddenly adb.exe would no longer respond (couldn't get any output from any adb command - it just appeared to hang).
In the end, my issue turned out to be another application I had installed on my development machine. It was starting as a service, and was listening on the exact same port that the adb server runs on (5037), which appeared to be confusing it. Once I changed the application to use a different port, adb started working again and everything was fine.
Run command
where adb
I had such kind of situation.
In my case
where adb
gave output
C:\Windows\adb.exe
D:\AndroidSDK\adt-bundle-windows-x86_64-20131030\sdk\platform-tools\adb.exe
I tried to run adb from disk C, when Eclipse used second adb from AndroidSDK (from disk D).
I removed adb from strange path C:\Windows\adb.exe, and this solved this problem.
I got the same problem,my solution is going to cmd and paste adb.exe path,and then click enter button.For example
D:\Android\Android\platform-tools\adb.exe

android: Failed to install .apk on device "device": timeout

A few days ago I started having troubles while trying to install a .apk on my Galaxy S2. I select my phone as the target, click OK and in the Console get the following error:
Failed to install AvatarRun.apk on device 'device number': timeout
Launch canceled!
Without changing anything in code and running again I can also get the error:
Failed to install AvatarRun.apk on device 'device number': device not
found com.android.ddmlib.InstallException: device not found Launch
canceled!
I have tried opening a command window and navigating to android-sdk\platform-tools and running:
adb kill-server adb start-server
This did not fix the issue.
This seems to just be a coincidence, but after failing many times I changed the minimum SDK in the Manifest from 10 to 7 and the .apk loaded on the next try, but has worked intermitently since and generates the same errors.
Can anyone suggest a method for finding what is causing this error?
After trying the fixes mentioned above, I ended up installing and reinstalling the Galaxy drivers. This didn't help. What eventually worked (so far) was to switch which USB port the Galaxy is plugged into. Once I did this everything was functioning as it should.
It may sound ridiculous, I tried all the ways suggested in Android error: Failed to install *.apk on device *: timeout
None of them works for me except unplugging the current cable and change for a new one.
There are various solutions:
Try changing the ADB connection timeout. The default is 5000; you should change it to 10000ms or so.
Window -> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)
Try to unplug and re-plug the cable. It seems that sometimes Eclipse loses the connection with Device. Sometimes you just need to plug into other USB port.
You might need to kill the ADB process and restart it.
adb kill-server and then
adb start-server
For me, the solution is to uninstall the old apk from the phone.
This problem often shows up if the computer is not fast enough. So,if you go to task manager you will see the performance. If you are watching video or running other programs at the same time while you are running your android application close other programs; at least during installing the app on device or emulator. You might even need to close internet browser.
You might need to update your computer to make it faster if you can.
Hope this helps someone:)

My device is not showing up in "Android Device Chooser" suddenly

i am using my samsung galaxy3 device for testing my apps from last two months. It is working fine.
But suddenly from this morning when i connected my device to my system it is not showing up in the "Android Device chooser" window.
I have checked, USB debug mode is in checked state only in my device.
Can anybody guess the problem. It is little urgent.
Thanks,
Nehatha
Use a shell of some sort (Run -> cmd) and browse to the /platform-tools/ directory inside the place you installed the Android SDK Tools.
Shut down Eclipse, unplug your device and try running:
adb kill-server
adb start-server
Plug it back in and run
adb devices
If you can see it, good. Now run:
adb logcat -c
adb logcat
This will flush the current logcat output and then show the logcat output in the shell as it updates (do something on the device and the log will update). Stop it with Ctrl-C and restart Eclipse.
This has helped for me sometimes.
Also, rebooting helps.
I have another similar issue over here which I haven't found an answer to yet: Device going offline randomly (and appearing multiple times as offline) in Eclipse - fixes?
Hope some of it helps.
I have the same problem and I figured out the solution for me.
On the home screen of your device choose Menu > Settings > Applications > Development.
Make sure that ‘USB debugging’ is checked.
Hope it will help someone :)
close the emulator then restart eclipse.
Finally my device is working after "Factory data Reset".
Thanks you all for your suggestions, even those suggestions not worked for me, I came to know about other useful.
Thank You.
I had similar issue, what worked for me was switching to "connected as camera" mode instead of "connected as media device" from the USB options menu, then performing Klaus's solution (kill server, start server).

Categories

Resources