emulator-5554 disconnected! Cancelling 'com.example.merhaba.Main activity launch'! - android

I started to write android app with eclipse IDE. But when I run the app I am taking emulator-5554 disconnected! Cancelling 'com.example.merhaba.Main activity launch'! error. What can I do?

The problem as I discovered lays in the fact the the project has no appropriate Virtual Device defined for it in the AVD manager.
So the recommended steps in eclipse are:
Go to "Project"-> Properties-> Android.
On the right pane see what line is checked in the Project build target.
Remember the target platform number that appears in the selected line.
Go to "Windows"-> AVD Manager.
Check the list of existing Android Virtual Devices for a device that matches the Platform and API level that you have set for your project (see step #2 above).
If there is no line that includes an AVD for your platform (as I suspect), add it using the "New" button.
A "Create New Android Virtual Device" window will be opened. set a new device name. in the "Target" selection box choose the right platform for your project.
--- OR ---
Open Android Virtual Device Manager
select the AVD you use for your app.
Press the start button and wait for a new form to show up called (Launch Options).
Check the box "Wipe user data" and hit "Launch" button.
This should work.
--- OR ---
Open Android Virtual Device Manager
Delete the AVD you use for your app.
Create an new AVD.
Start you new AVD.
This should also work.
-- OR --
try this..
go to DDMS perspective-->select Device-->go to Window-->Navigation-->Show view menu-->reset adb.. .
Enjoy your emulator once again!

This solved it for me:
1) Leave Eclipse open and the emulator also open even though Eclipse doesn't find it.
2) In command line type:
adb kill-server
Then when prompt comes back, type
adb start-server
3) After adb starts again, try to run your project again from Eclipse.

You can kill ADB from the Window Task manager but I advice you kill the ADB process tree. By right clicking on the adb on the Task manager and then click on END Process TREE. That worked for me and I believe it will help you to solve the problem. But make sure you have your AVD recognised. To do this click window--AVD Manager--click on the AVD you want to use to highlight it, then click on the START tab--The launch options opens up. Click on Wipe user data and then click on LAUNCH. That will help you launch your identified AVD before you go ahead to kill Adb process tree as I described earlier. That did the magic for me. After doing this try running the program. If you get an error like "Activity not working", don't panic. It's not an error but it's just there to tell you that you are running your program again without any change or update on the code. You can just click the backward button on your emulator and then run again and you won't see that error again.

Go to run-> configuration->Target->select Avd -> Run it. It solved my problem which made me crazy

just restart your eclipse and run it again

Go to the Device view and on the upper right corner there is a down arrow, click there an later on reset adb..after a few seconds try to re-run the app,it should work.

Related

Eclipse - Empty Logcat with Android 7

I recently updated my Nexus 9 Tablet to Android 7 Nougat.
Since then the Logcat view in Eclipse stoped displaying Logcat messages, the view just stays empty.
Also the devices target is shown as "Unknown".
If I instead start Logcat outside Eclipse (AndroidSDK->tools->ddms) it displays all messages. However, then the "Application" Column stays empty.
There are allready some (older) questions on this topic here on SO, but none of the solutions here worked for me.
What i tryed:
Use another USB Port
Focus the device in the DDMS perspective
Restart Eclipse
Reboot the device + pc
abd kill-server
disable and re-enabled USB Debuging on the device
Reset the USB-Debuging authorization and confirm the RSA fingerprint again
Switch USB-Mode to "MTP"
Every installed package from the Android SDK is up to date and i use latest Eclipse+ADT Plugin.
Also everything works fine with my Galaxy S5 Mini (Android 5.1.1).
I know, that the ADT-Plugin is deprecated and we should use Android Studio.
However I still preffer to use Eclipse as long as possible, so I am looking for a solution for this problem.
So does anyone know how to solve this issue?
I tried with this custom build and it works for me. Now I can see my logcat in Eclipse again.
https://github.com/khaledev/ADT/releases
Download the zip file then in Eclipse menu Help > Install New Software... > Add > Archive...
Just pick the downloaded zip and do the rest of the install process.
can use "Android Device Monitor" Application,
This application in the sdk-tools package.
Launch From the command line,
cd to the "sdk-tools folder/tools/" directory,
enter the following command : monitor.
or
windows environment,
open the directory "sdk-tools folder/tools/",
and double click monitor.bat.
detail -> Google User Guide
I had the same problem. Eventually, I found out that the "Eclipse IDE for Android Developers" was out of date. Updating this feature fixed the problem. Procedure:
Open Help -> About Eclipse -> Installation Details
Select "Installed Software" tab
Select "Eclipse IDE for Android Developers"
Click "Update" in the bottom.
Try to launch directly sdk tool monitor from Android SDK, it can be found in:
sdk-tools folder/tools/
you'll see monitor.bat, click on it to launch Android Device Monitor oustside Eclipse, don't forget to create a filter for your APP, go to logcat window-> Saved filters -> + -> fill your app name in "by Aplication Name"
If nothing works, in an emergency, you may try this to get logcat over command line (use cmd in windows), type :
adb logcat --pid=YOUR_APP_PID_NUMER
this shows messages from your APP. if you don't know your PID, put a line in your APP code:
System.out.println("foo stuff I can find easily when I read logcat results");
Run your app, make sure you get the up line executed.
Then in your command line type:
adb -d logcat System.out:I *:S
Find your line System.out.println("foo... and read the PID number, is next right to time data.
And then
adb logcat --pid=pid number you read from your comment line
to get logcat messages from your app in the command shell in real-time.
If you just want messages output till now, just add -d modifier:
adb -d logcat --pid=pid number you read from your comment line

Incompatible Android emulator running in background

I am Using the latest Android SDK in my Win 7. But whenever I try to launch my any android projects it shows the following window :
I have checked the .android/avd/ folder but there are only 3 avds there. What is wrong with the AVD or anything wrong in my work.
Do you actually have an AVD instance running? If so, have you tried clicking OK when you hit that screen?
If you don't have an AVD running, have you tried restarting Eclipse/AVD Manager/your machine?
This dialog is indicating that you have an AVD running already. It's basically prompting you to select an AVD to send the app to. At least in my setup, selecting OK at this screen should run the app in the active AVD.
Try adb tcpip 5554. This will restart your ADB listening to the port 5554. The entry will go away.

Connection with adb was interrupted You may want to manually restart adb from the Devices view

I am using Windows 7 and JDK 6.
I downloaded the package of Android SDK with Eclipse and followed the instructions to create the first Hello World application.
However, when I stand on MainActiviy.java and click on run I get the following error in the console:
Connection with adb was interrupted You may want to manually restart
adb from the Devices view.
I tried many answers that I saw here:
1. Restart adb server
2. Make sure that the path is to the correct JDK
3. I went over preferences and didn't see any warning or error.
I can run the emulator- and it works fine. But it doesn't run the Hello World application.
What is wrong?
I had to go to DDMS view, and in view menu of the devices, to choose:
restart ADB.
This made everything work fine
Here are followed list of options what you can do to try to fix that issue:
Run: adb kill-Server , after adb start-Server
Try to disable and after set enable USB debugging on device.
While doing that pulling out the USB cable and putting it back in also helps.
Just wait, sometimes it happens if it up slowly and Eclipse drop this error.
Try to kill adb.exe through Task Manager. It will restart by different way.
You can try to up performance to your Eclipse (mostly for Android):
open eclipse.ini and set:
-Xms128m
-Xmx512m
-XX:MaxPermSize=256m`
try to disable firewall
Uninstall previous versions of JRE or JDK (if you have ones in additional to new that you currently use). After, restart Eclipse
Does DDMS see your emulator? Try to restart adb through DDMS
Also add (if still you didn't) ADB to global path: My Computer -> Properties -> Advanced System settings -> Environment Variables -> press New... name: ADB; value: <your android SDK path>\platform-tools. after add to path %ADB%
Expanding on Dejel's answer above with one change:
Window -> Open Perspective -> DDMS (DDMS could be in the "Other..." section)
Window -> Show View -> Devices (if not already visible on the left pane)
Under the view-meny (little downward-pointing triangle on "Devices" header) choose "Reset adb" (Restart may have been renamed to "reset" in newer versions).
Me too had the similar problem. Struggled alot to resolve and finally this worked out for me.
Remove all the folders in the root folder of workspace(except workspace folder) like .android, .eclipse, .metadata etc
Save your platfoms to some safer place and delete the folder "adt-bundle-windows-x86-20130729"
Unzip the bundle again to some other locations
Try running the eclipse again and create an application
Run the application and see whether emulator automatically gets starting
Paste back ur platforms
This worked for me on my 4th attempt.
I did some thing very simple.. I copied the adb.exe from users folder (users//android-sdks/platform-tools to tools folder under android-sdks.
Then in preferences under Android i clicked "restore Defaults" then again browsed back to C:\Users\\android-sdks then clicked on the latest API (19) clicked ok..
then it worked!!
This worked for me:
simply go to device manager in your laptop or pc -> go to processes -> click on adb and -> click on end process.
Now go to sdk folder (it may be locate various location in your drive) and right click on adb.exe and click run as administrator.
Now check if it works fine.
This always works for me. Follow these steps :-
Close Eclipse.
Kill adb.exe from Task Manager (Windows Only)
Disconnect your device.
Reconnect your device.
Start Eclipse and Wait for Eclipse to build workspace.
P.S. This works perfectly on a Physical Device. I haven't tried it on Emulator.

Android emulator won't shut down

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

HelloAndroid]emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity launch'!

I am new to Android. Follow the HelloAndroid Tutorials by use Eclipse.
After run HelloAndroid, the AVD 'xian_avd2' lunched, but stop there, no " Hello, Android"
displayed on AVD. Looks like Waiting for HOME ('android.process.acore') to be launched...
Not know how to resolve this, please help.
Thanks
wang813
[2010-01-29 00:12:13 - HelloAndroid]------------------------------
[2010-01-29 00:12:13 - HelloAndroid]Android Launch!
[2010-01-29 00:12:13 - HelloAndroid]adb is running normally.
[2010-01-29 00:12:13 - HelloAndroid]Performing com.example.helloandroid.HelloAndroid activity launch
[2010-01-29 00:12:13 - HelloAndroid]Automatic Target Mode: Preferred AVD 'xian_avd2' is not available. Launching new emulator.
[2010-01-29 00:12:14 - HelloAndroid]Launching a new emulator with Virtual Device 'xian_avd2'
[2010-01-29 00:12:37 - HelloAndroid]New emulator found: emulator-5554
[2010-01-29 00:12:37 - HelloAndroid]Waiting for HOME ('android.process.acore') to be launched...
[2010-01-29 00:13:59 - HelloAndroid]emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity launch'!
Open Android Virtual Device Manager
select the AVD you use for your app.
Press the start button and wait for a new form to show up called (Launch Options).
Check the box "Wipe user data" and hit "Launch" button.
This should work.
--- OR ---
Open Android Virtual Device Manager
Delete the AVD you use for your app.
Create an new AVD.
Start your new AVD.
This should also work.
The problem as I discovered lays in the fact the the project has no appropriate Virtual Device defined for it in the AVD manager.
So the recommended steps in eclipse are:
Go to "Project"-> Properties-> Android.
On the right pane see what line is checked in the Project build target.
Remember the target platform number that appears in the selected line.
Go to "Windows"-> AVD Manager.
Check the list of existing Android Virtual Devices for a device that matches the Platform and API level that you have set for your project (see step #2 above).
If there is no line that includes an AVD for your platform (as I suspect), add it using the "New" button.
A "Create New Android Virtual Device" window will be opened. set a new device name. in the "Target" selection box choose the right platform for your project.
Enjoy your emulator once again!
Try to use the command emulator -avd emulator_name -wipe-data
I had a similar problem -- it ended up I wasn't waiting long enough for the emulator to run the OS before trying to install the app. Launch the emulator and then wait for the home screen to appear before running the app in Eclipse.
Maybe it's an AVD problem for existing machine. Try to create a new AVD from the AVD Manager and delete the old one.
This can happen on slow computers when the emulator doesn't start in time. When it eventually does start, it is no longer connected to ADB. The solution is to restart ADB so that it reconnects to the emulator. You can do this by executing the following in command line:
adb kill-server
adb start-server
For me, I believe it happened due to an unexpected power failure while the emulator was running. Having it not shut down properly meant that my session was still cached. (I would occasionally get these errors too):
[2012-06-08 05:05:06 - Emulator] WARNING: Data partition already in use. Changes will not persist!
[2012-06-08 05:05:06 - Emulator] WARNING: SD Card image already in use: C:\Users\Ben\.android\avd\Ben-Android.avd/sdcard.img
[2012-06-08 05:05:06 - Emulator] WARNING: Cache partition already in use. Changes will not persist!
If this happened to you, pull up the command line, navigate to your android-sdk\tools and follow the corrected top post: emulator -avd emulator_name -wipe-data
I resolved it (Mac) by following these steps,
Run Emulator
Keep the Emulator, (no matter same error occurs)
Make Sure the Home Screen of Emulator is appeared
go to Window -> Show Perspective -> DDMS --> In Devices Panel -> on Corner Drop Down Menu -> Reset adb
I Hope it helps
for me didn't worked:
./emulator -noaudio #androidDev1
so I used:
./emulator #androidDev1
and it worked perfectly! :)
Also check Eclipse IDE:
Windows->Preferences->Android->Launch->Options
It should be empty
I was having the same issue, I deleted my AVD and created afresh - after that I do not see such problems.
also same problem for me..
go to DDMS perspective-->select Device-->go to Window-->Navigation-->Show view menu-->reset adb..
it works for me.
Disable snapshot and don't use it. It is what solved this issue in my case
delete the avd and create another helped me
Try 1 more time. If it occurs again
Goto Project->clean and
Right click your project and choose refresh..
This worked on Linux for me:
Run Emulator (Wait for the home screen of the Emulator to load)
Click Window > Open Perspective > DDMS
In Devices Panel, click on drop down menu > Reset adb
Run project
It comes down to just making a new AVD with moderate settings, at least that's what fixed it for me. Though every time I close it I have to make a new one. Guess just wait for a patch.
Click Android Device Manager button on the second toolbar.
Click New.
Set up a mid-range device, basically just select a phone model from the middle of the list that isn't a tablet. The memory should fill it self in, then just put like 20mb for the SD card.
Click Start. The AVD will now start up and load the Android OS.
Then Run your app on said device.
Once you get this problem it seems to remain unless you do a full reinstall... Basically, always start the AVD first, let it hit the android home screen, then run your app. This way Eclipse doesn't overload the sluggish emulator.
And I got the solution from here. It perfectly works for me.

Categories

Resources