Android Launch is Failing - android

I am trying to develop my first Android app through the ADT plugins for Eclipse. I have downloaded and installed both ADT and the Android SDK and have created a HelloAndroid Android project. I created a new AVD called HelloAndroidEmulator1 just for testing my HelloAndroid app.
When I go to run my project (rooted at HelloAndroidActivity.java which was autogenerated for me), I'm getting some bizarre errors. I have not changed any of the source code that Eclipse generated for me, and have not added any of my own code. I'm simply trying to compile and run what was autogenerated.
When I look in the layout/main.xml file's Graphical Layout, I see a rendering of my app displaying the text:
HelloAndroid
Hello World, HelloAndroidActivity!
Where HelloAndroid is the name of my Eclipse project and HelloAndroidActivity is the name of my main driver that Eclipse makes for me.
When I go to actually run the application, I do not get anything like that output at all. The emulator loads up, and after about 60 seconds of displaying the startup "android" splash screen, it starts to load up but then gives me an error:
Launcher is not responding. Would you like to close it?
Back inside Eclipse, my console output looks like this (after I've closed the launcher):
[2012-01-03 11:23:23 - HelloAndroid] ------------------------------
[2012-01-03 11:23:23 - HelloAndroid] Android Launch!
[2012-01-03 11:23:23 - HelloAndroid] adb is running normally.
[2012-01-03 11:23:23 - HelloAndroid] Performing net.me.myprojects.android.proj.HelloAndroidActivity activity launch
[2012-01-03 11:23:23 - HelloAndroid] Automatic Target Mode: Preferred AVD 'HelloAndroidEmulator1' is not available. Launching new emulator.
[2012-01-03 11:23:23 - HelloAndroid] Launching a new emulator with Virtual Device 'HelloAndroidEmulator1'
[2012-01-03 11:23:36 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error
[2012-01-03 11:23:36 - HelloAndroid] New emulator found: emulator-5554
[2012-01-03 11:23:36 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2012-01-03 11:25:00 - HelloAndroid] HOME is up on device 'emulator-5554'
[2012-01-03 11:25:00 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554'
[2012-01-03 11:25:00 - HelloAndroid] Installing HelloAndroid.apk...
[2012-01-03 11:27:03 - HelloAndroid] Failed to install HelloAndroid.apk on device 'emulator-5554!
[2012-01-03 11:27:03 - HelloAndroid] (null)
[2012-01-03 11:27:03 - HelloAndroid] Failed to install HelloAndroid.apk on device 'emulator-5554': EOF
[2012-01-03 11:27:03 - HelloAndroid] com.android.ddmlib.InstallException: EOF
[2012-01-03 11:27:03 - HelloAndroid] Launch canceled!
I tried searching online but couldn't find anything that jumped out as being the clear culprit. I must not have something installed or configured correctly, but I can confirm that:
ADT is installed inside Eclipse
The SDK is installed under C:\Users\me\android-sdk
I can open and edit both the SDK and AVD Managers
Edit: Here is the source for HelloAndroidActivity.java:
package net.me.myprojects.android.proj;
import android.app.Activity;
import android.os.Bundle;
public class HelloAndroidActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Any ideas as to what is happening here?!?! Thanks in advance!

Make sure your Virtual Device has a valid SD card size (i.e. bigger than 0)

Try few fixes:
Shut down the emulator and the IDE and relaunch the application.
Window -> Android SDK and AVD Manager -> Create a new AVD manager with different name and launch it.
If this doesn't work then give me your HelloAndroidActivity class. I will try to run it on my machine and will see.
Add text view to it..
public class HelloAndroidActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
If you are still getting any error follow this tutorial. Android Tutorial

I had the same error while I was working with a new App which used SQLite.
Anyways, the issue was that even after you close your Eclipse and Emulator.. in Task Manager the process adb.exe or abd.exe*32 was still running.
Steps:
1. Close eclipse and emulator.
2. Kill the process adb.exe or abd.exe*32.
3. Start your eclipse, clean build your app once and its almost like new.
Happy coding.

For me, the error went away on its own after trying to re-run multiple times. Possibly the system filtered itself of some old copy in memory after a while.

Start the emulator manually and check whether your app is installed. If its installed just delete it and retry to launch your app with eclipse.

Related

My android emulator doesnt launch

I installed the Android Development Tool and created my first app but when I run the app, the emulator doesnt launch.The console reads:
[2013-06-18 14:36:57 - MyFirstApp] Android Launch!
[2013-06-18 14:36:57 - MyFirstApp] adb is running normally.
[2013-06-18 14:36:57 - MyFirstApp] Performing com.example.myfirstapp.MainActivity activity launch
[2013-06-18 14:37:19 - MyFirstApp] Launching a new emulator with Virtual Device 'AVD'
Unfortunately, it never launches. The following is what I have tried to do to solve the problem:
I created AVD both by graphical user interface and command line but it didnt run.
I tried to open task manager and stop the adb.exe process then run it again but no.
I tried to kill the adb server and restart it by command line but again no, didnt run.
I finally tried to launch the emulator on command line and this is what it says (directly translated): "a problem interrupted the program, trouble-free operation. Windows will close the program and notify you if a solution to the problem is available."
Please help.
After a long struggle, I decided to install a new Operating System. The emulator can now launch.

After change some code, should i restart the Android Emulator?

I have opened the Android Emulator for my first set of code change. Then later i change some of my code. Should i want to close the emulator and relaunch (re-run) the code to reflect my new changes? or else simply pressing run key in eclipse will reflect the changes?
Please clarify.
PS : Till now, i wont close and relaunch the emulator for every code change. But today i faced the error in console like "Application already running, uninstall the application and try". That's why i have doubt on this.
You do not need to relaunch the emulator, pressing the Run button in Eclipse will work.
When you receive a message similar to this one:
Re-installation failed due to different application signatures.
You must perform a full uninstall of the application. WARNING: ...This will remove the application data!
Please execute 'adb uninstall com.antew.code' in a shell.
Open a command prompt and use:
adb uninstall <package name>
e.g.
adb uninstall com.antew.code
Then relaunch the application from Eclipse to install it again. The adb exe is in the /platform-tools/ folder of the SDK.
no need to close the emulator at all .............
the message is due to as some time application is in front (running) emulator denys to re-run . For this just simply close the app by back button and run from eclipse
There is no need to restart the emulator for a code change -- simply "Run"ning it from Eclipse does the trick. I think the reason you're getting that error is that you're trying to run it with no code changes.
Don't restart your emulator for every changes made. Just deploy your application on the emulator.
If you won't face the Application already running, uninstall the application and trybe sure that your application is not started in the emulator.
If it is,just switch to another ativity and then try deploy your application.
There is no need to restart the emulator!!!
You simply need to run youe application again from eclipse(Ctrl + F11). If you have done any changes in code(and saved them all) then on running the application you will get output something like below
[2013-06-19 13:19:12 - MyFirstApp] ------------------------------
[2013-06-19 13:19:12 - MyFirstApp] Android Launch!
[2013-06-19 13:19:12 - MyFirstApp] adb is running normally.
[2013-06-19 13:19:12 - MyFirstApp] Performing com.example.myfirstapp.MainActivity activity launch
[2013-06-19 13:19:12 - MyFirstApp] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Micromax_A_68'
[2013-06-19 13:19:12 - MyFirstApp] Uploading MyFirstApp.apk onto device 'emulator-5554'
[2013-06-19 13:19:14 - MyFirstApp] Installing MyFirstApp.apk...
[2013-06-19 13:19:26 - MyFirstApp] Success!
[2013-06-19 13:19:26 - MyFirstApp] Starting activity com.example.myfirstapp.MainActivity on device emulator-5554
[2013-06-19 13:19:28 - MyFirstApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.myfirstapp/.MainActivity
Above logs are specific to my app but you get the point... If you have no changes saved then you will get some additional output lines as follows
...
[2013-06-19 13:22:10 - MyFirstApp] Application already deployed. No need to reinstall.
...

Debugging Android 'hello world' app with Eclipse, variable view super slow

I have installed latest version Eclipse Classic (3.7.1),
Android sdk (r16)
jdk x64 6u30 (also tried 6u25 and ver. 7)
Platform tools etc.
My computer specs: Intel i5-2500K, 16GB DDR3 Ram.
OS: Win 7 (x64 Prof), also tried in VirtualBox (WinXP SP3 x32).
So i followed the official 'Hello World' tutorial from Google site:
package com.test.AndroidApp;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class TestAppActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android...."); // BREAKPOINT HERE
setContentView(tv);
}
}
console messages when starting debugger:
[2012-02-11 00:45:39 - hello] ------------------------------
[2012-02-11 00:45:39 - hello] Android Launch!
[2012-02-11 00:45:39 - hello] adb is running normally.
[2012-02-11 00:45:39 - hello] Performing com.example.helloandroid.HelloActivity activity launch
[2012-02-11 00:45:39 - hello] Automatic Target Mode: Preferred AVD 'avd' is not available. Launching new emulator.
[2012-02-11 00:45:39 - hello] Launching a new emulator with Virtual Device 'avd'
[2012-02-11 00:45:42 - Emulator] emulator: WARNING: Unable to create sensors port: Unknown error
[2012-02-11 00:45:42 - hello] New emulator found: emulator-5554
[2012-02-11 00:45:42 - hello] Waiting for HOME ('android.process.acore') to be launched...
[2012-02-11 00:45:51 - hello] HOME is up on device 'emulator-5554'
[2012-02-11 00:45:51 - hello] Uploading hello.apk onto device 'emulator-5554'
[2012-02-11 00:45:51 - hello] Installing hello.apk...
[2012-02-11 00:45:55 - hello] Success!
[2012-02-11 00:45:55 - hello] Starting activity com.example.helloandroid.HelloActivity on device emulator-5554
[2012-02-11 00:45:55 - hello] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.helloandroid/.HelloActivity }
[2012-02-11 00:45:56 - hello] Attempting to connect debugger to 'com.example.helloandroid' on port 8627
And when the debugger hits the breakpoint, i point mouse cursor to the 'tv' variable, the Variable hint window is displayed and is being filled veeeeeery slowly.
It takes 0.5-1 sec to display each member of tv (TextView), by display i mean to draw variable icon, name and value.
While the debugger displays all members of 'tv' i can scroll it down to the bottom, select any variable (i don't see them, but i can select them if i click somewhere to the left of the hint window) and most interesting part - i can see var member value! (without name, only value).
It takes about 1 minute to display all members of 'tv'. (processor load is 0-2% during this time)
If i close hint window, and open it again - the process repeats, taking 1 minute again.
Variables view window behaves the same way as a hint popup window. (i open up 'tv' variable and it takes 1 min. to display all its members).
I tried doing the same in VirtualBox machine with winxp32, no luck.
I tried using another computer at the office (core E6600, win 7 prof x64) - no luck.
I tried installing Eclipse on MacOs (hackintosh using the same machine) - works blazingly fast.
After Googling about this problem i found the same bug report, dated 2006, and it has been fixed in eclipse 3.1.6.
Is it only me?
I didn't find anyone else mentioning this problem. Maybe no one else has installed latest eclipse and adt plugin yet?
p.s.
I've developed apps for iOs on the same machine, and there was no such problem.
I also have tried to debug simple Java project - variable hint and window works fast!
Sounds like the same issue as this question
Eclipse auto suggest list very slow
I had the same problem and found my answer here
https://groups.google.com/group/android-developers/browse_thread/thread/85dc1aae3bafff5e
In summary - "turn off JAX-WS Proposals in Content Assist
Window > Preferences --> Java > Editor > Content Assist > Advanced "
Wow... Look how far we've come.
You can download Android Studio now.

Android Simulator Not Responding

I'm using eclipse and have the android plugin. I made a simulator that is running 1.6. I'm trying to run the demo app that it comes with and it freezes on me and I have to end the process. I never get it to run the demo. Anyone have some advice?
Demo App Code:
package com.demo.DemoApp;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
My Output:
[2011-06-29 15:31:32 - DemoApp] ------------------------------
[2011-06-29 15:31:32 - DemoApp] Android Launch!
[2011-06-29 15:31:32 - DemoApp] adb is running normally.
[2011-06-29 15:31:32 - DemoApp] Performing com.demo.DemoApp.MainActivity activity launch
[2011-06-29 15:31:32 - DemoApp] Automatic Target Mode: launching new emulator with compatible AVD 'Test-Device-1.6'
[2011-06-29 15:31:32 - DemoApp] Launching a new emulator with Virtual Device 'Test-Device-1.6'
[2011-06-29 15:31:41 - DemoApp] New emulator found: emulator-5554
[2011-06-29 15:31:41 - DemoApp] Waiting for HOME ('android.process.acore') to be launched...
[2011-06-29 15:32:29 - DemoApp] emulator-5554 disconnected! Cancelling 'com.demo.DemoApp.MainActivity activity launch'!
This is not a solution for your particular problem, but i gave up on the simulator, is just to cumbersome and slow. Get a real device, your life will improve greatly. They are fairly cheap right now. Trust me, the simulator is just not worth your patience.
Wipe user data on the simulator to start it from scratch. That usually resolves this problem for me.
The android default emulators are very slow. You can use any real device or Gennymotion in your system. Gennymotion simulators have better performance than the default ones.

Android app is not launching

i had a working application until i changed the package name in the AndroidManifest.xml. I changed it back, but then i found that i had two files in the gen folder.
I usually (as now) have sg like this:
But that time had something else in my gen folder: just "com.bfarago" as far as i remember and another R.java inside that was complaining about the package name. I deleted this package with the R.java and since then i cannot launch the application.
I exited and restarted eclipse and at the launch its stuck at this point:
[2011-02-12 14:04:55 - Nevnap] Android Launch!
[2011-02-12 14:04:55 - Nevnap] adb is running normally.
[2011-02-12 14:04:55 - Nevnap] Performing com.bfarago.nevnap.MainActivity activity launch
[2011-02-12 14:04:55 - Nevnap] Automatic Target Mode: launching new emulator with compatible AVD 'my_avd'
[2011-02-12 14:04:55 - Nevnap] Launching a new emulator with Virtual Device 'my_avd'
[2011-02-12 14:04:55 - Emulator] emulator: ERROR: the user data image is used by another emulator. aborting
[2011-02-12 14:04:59 - Nevnap] New emulator found: emulator-5554
[2011-02-12 14:04:59 - Nevnap] Waiting for HOME ('android.process.acore') to be launched...
Logcat:
02-12 14:06:21.795: WARN/MountService(65): Waiting too long for mReady!
Later i will need to recreate the whole app but now i want this to work again.
Please help me..
You can safely delete any R.java and it will regenerate them for you. Try making a new AVD and restarting your computer to fix the second problem .
(I am posting this to close the topic as i first commented this weeks ago)
Thank you guys. Luckily i had the .apk file on my phone so I just copied it to computer and now it's working again.

Categories

Resources