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.
Related
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.
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.
I setup the hello world project as per the tutorial ... and it did (at least once) display on the emulator (but not the first time, that I recall). I can't duplicate this. The log says:
[2011-10-04 17:11:38 - Hello World] ------------------------------
[2011-10-04 17:11:38 - Hello World] Android Launch!
[2011-10-04 17:11:38 - Hello World] adb is running normally.
[2011-10-04 17:11:38 - Hello World] Performing ca.daveg.helloworld.HelloWorld activity launch
[2011-10-04 17:11:38 - Hello World] Automatic Target Mode: Preferred AVD 'testA' is not available. Launching new emulator.
[2011-10-04 17:11:38 - Hello World] Launching a new emulator with Virtual Device 'testA'
[2011-10-04 17:11:42 - Emulator] emulator: warning: opening audio input failed
[2011-10-04 17:11:42 - Emulator]
... which is odd. I don't know what audio has to do with anything ... and I do have a headset connected to the computer (with both mic and headphones attached).
The emulator just boots (and works fine) without displaying my app. I've tried 2.2, 2.3 and 3.1.something. I've tried different heap sizes. I've searched this site extensively, but none of the standard hints (running app.exe various ways, etc) have helped.
Even saying the emulator is slow --- I've waited for it, but my system is a 4.2Ghz i7 with 6 Gig of RAM and fast disks... so nothing can be terribly slow on it.
FYI, here's the code as I have it right now...:
package ca.somedomain.helloworld;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloWorld 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 2");
setContentView(tv);
}
}
this problem has been explored numerous times with numerous resolutions.. it's not your code.
Try killing the adb by just issuing the command adb kill-server and then adb start-server on your command prompt.
some kill people kill the abd.exe process.. then do an uninstall of their application if that exists. If you search for this error.. you'll find plenty of example resolutions here on stackoverflow.
Ironically, the answer was provided not by anything I can find on the forums, but by the upgrade notes of the next version of the SDK:
The problem was a space in the filename of the package.
I'm following the book "Professional Android 2 Application Development" by Reto Meier. I created the "HelloWorld" project. I use Eclipse as an IDE. If I run the application then the simulator starts but my application cannot run. he following information is displayed in the console:
[2011-07-03 16:03:28 - Hello_world] ------------------------------
[2011-07-03 16:03:28 - Hello_world] Android Launch!
[2011-07-03 16:03:28 - Hello_world] adb is running normally.
[2011-07-03 16:03:28 - Hello_world] Performing com.paad.HelloWorld.Hello_worldActivity activity launch
[2011-07-03 16:03:28 - Hello_world] Automatic Target Mode: Preferred AVD 'device2_1' is not available. Launching new emulator.
[2011-07-03 16:03:28 - Hello_world] Launching a new emulator with Virtual Device 'device2_1'
[2011-07-03 16:03:56 - Hello_world] New emulator found: emulator-5554
[2011-07-03 16:03:56 - Hello_world] Waiting for HOME ('android.process.acore') to be launched...
[2011-07-03 16:05:12 - Hello_world] emulator-5554 disconnected! Cancelling 'com.paad.HelloWorld.Hello_worldActivity activity launch'!
I cannot understand why my application is not able to run.
Did you wait until the emulator finished starting?
The log you posted may indicate that you closed the emulator before it started up.
The start takes a while, depending on the device configuration you have chosen (up to 5 minutes for me, if I try to launch a tablet emulator).
While starting, it goes to a small text saying "android" to an android text-logo and after that its usually up
And did you unlock them emulator? The emulator behaves like a real phone,
there is the usual key-lock in place. You have to release that first,
depending on the android version your are using you either have to drag a handle sideways
or press the menu key (e.g. in Android 1.6). If the phone is locked, you cant launch your app. There should be some info text on the screen telling you what to do.
After you got that, try to run your app again. It should start.
Please note that you can leave the emulator open once you started it.
If you run your application, the newest version will always be uploaded into the
emulator and executed. No need to restart the emulator all the time (which takes ages).
Android has some very good official documentation and tutorials. I suggest you try starting with the "official" Hello World example. I started there with my first Android app, and it worked as advertised for me.
You could post your code so we can see possible problems.
You can also look at warnings and errors with LogCat (Window > Open Perspective > Other... > DDMS or something). Then use Log.d or Log.e in your code so you can trace how far it gets before messing up.
Hello stackOverflow readers,
I am hoping that this is a simple setup issue, but here it goes:
Eclipse 3.6.0
AVD 2.2 and 1.5 (created both and tried with both)
XP Pro 2002 SP3
I followed the tutorial at site http://developer.android.com/resources/tutorials/hello-world.html but my custom TextView control never rendered.
I set a few breakpoints in the public class HelloAndroid extends Activity method and these breakpoints are never tripped. It is as if my android.process.acore is never run, based on the console output.
I am tempted to remove all and reinstall the packages, but I thought I would ask the web for a little guidance first.
This is the output in the console window:
[2010-08-24 12:05:08 - HelloAndroid2] Android Launch!
[2010-08-24 12:05:08 - HelloAndroid2] adb is running normally.
[2010-08-24 12:05:08 - HelloAndroid2] Performing com.example.helloandroid2.HelloAndroid activity launch
[2010-08-24 12:05:08 - HelloAndroid2] Automatic Target Mode: launching new emulator with compatible AVD 'My_avd_2_point_2'
[2010-08-24 12:05:08 - HelloAndroid2] Launching a new emulator with Virtual Device 'My_avd_2_point_2'
[2010-08-24 12:05:11 - HelloAndroid2] New emulator found: emulator-5554
[2010-08-24 12:05:11 - HelloAndroid2] Waiting for HOME ('android.process.acore') to be launched...
< I then kill the Android simulator here >
[2010-08-24 12:05:34 - HelloAndroid2] emulator-5554 disconnected! Cancelling 'com.example.helloandroid2.HelloAndroid activity launch'!
Thanks in advance for helping me understand this issue.
What is displayed in the emulator screen ? Do you get to the "unlock" screen ?
It seems you don't wait enough for the emulator to launch.
I have the same issue but waiting and using the on/off button does not work. (I have the unlock screen up.)
Oddly, a different tutorial appears to work (Simple Flashlight).
Never mind - newbie issue I guess.
I got it to work by using (the Menu button, followed by) the Launcher icon, followed by choosing my app.