Dabbling in Android SDK r11 and Eclipse Ver3.7 Indigo and ADT plug-in

Since the Blocks Editor and Android emulator was horribly slow and unreliable… Ive moved on the Android SDK r11 and it’s Android SDK AVD Manager

*** Latest  – I’m using the Bluestack windows based Android emulator to run anything from Eclipse that compiles without errors to an .apk file.  See this posting https://mrobvious.wordpress.com/2011/10/13/i-got-bluestack-to-work-with-my-android-2-3-3-app-sweet/

*** Latest

I have gotten one click event to work, that only writes a Toast message on the screen (Not a textbox yet)

private void showToastMessage(String msg){

Toast toast = Toast.makeText(this, msg, Toast.LENGTH_SHORT);

toast.show();

}

The critical things I’m doing seem to be:

1. [Project] then [Clean…]

2. On the “Run” toolbar dropdown, do [Run Configurations…] then click the [Target] tab

Make sure you have the correct emulator/android version and scroll down to check off “Wipe User Data”

Then ‘apply” and “Run”

This seems to launch and load the emulator in a more stable way. (still pretty slow and some App stopped

unexpectedly, but SOME success too)

*** The state of things:

I have one app that crashes “Stops Unexpectedly” as you launch it (never even shows the GUI)

and the other launches ok and you see the buttons….but “Stops Unexpectedly” when you click on a button.

1. One person suggested there might be errors in manifest…Mine was autogenerated by Eclipse.  Fix what?

2. One person suggested doing [Project] then [Clean…] in Eclipse

3. Another said there were known bugs and alleged workarounds in the windows Eclipse.  Anyone point to links for this?

Has anyone gotten any complete example working on this emulator? 

It’s really starting to feel like this is broken and Google and IBM need to fix.

I have Java 6 and Eclipse Ver 3.7 Indigo loaded

________________________________________________

Thanks for checking  out my posting.  Check  out the latest at https://mrobvious.wordpress.com No scraping please….. ________________________________________________

First off… when you launch Android SDK AVD Manager it tries to download and then install how ever many of the Android emulator platforms for Windows (in  my case although there are Linux and Mac versions)

They are shown as

api12 (really Android Honeycomb 3.1)

api11 (really Android Honeycomb 3.0)

api10 (really Android  Gingerbread 2.3.3)

api9 (really Android Gingerbread 2.3.1)

api8 (really Android Froyo 2.2)

— I guess Ice Cream Sandwich will be 4.0 but it isnt released till fall 2011

** The first weirdness is…All of those downloads show as Linux… except the api8 = Froyo 2.2

** The second weirdness… is… the .zip files download fairly fast… HOWEVER…

the zips extract REALLY slow.

So…. I allowed the SDK AVD Manager to download them  one at a time… then stop the install part and kill the process.

Then I extracted the 3.1 zip in Win7… That and the copy to “platforms folder” took about 2 hours.  There are 4600 items in the “data” subfolder…

The 2.3.3 vintage zips took about an hour and fifteen minutes each…

** Then I relaunched the Android SDK AVD Manager… all the platforms are there now. … and I created an AVD Emulator for each…. So… it appears that all of the zips were windows and only mislabeled Linux.

Android 3.1 Honeycomb AVD Emulator

Android 3.1 Honeycomb AVD Emulator

Now, on the Eclipse Indigo Java IDE side… I launched the Android ADT plug-in that I downloaded but it isn’t recognized yet. (See the green text below..)

So, now I’m exploring how to get an example going in java in the Eclipse IDE and connect to the AVD Emulator….and preferably to connect java examples to the emulator WITHOUT Eclipse which allegedly is possible..

*** I tried adding  ADT Android for Ecplipse Ver 3.7 Indigo again…

This time I did it from within Eclipse Indigo…Using the menu bar [Help], [Install new software] then you have to supply it a URL that I got from this site for Android developers.

http://developer.android.com/sdk/eclipse-adt.html#downloading

  1. Start Eclipse, then select Help > Install New Software….
  2. Click Add, in the top-right corner.
  3. In the Add Repository dialog that appears, enter “ADT Plugin” for the Name and the following URL for the Location:
    https://dl-ssl.google.com/android/eclipse/

Continue following the site steps through 7 and this correctly installs the ADT plug-in into Eclipse Ver 3.7 Indigo IDE.  Previously, I tried downloading the ADT separately and I couldn’t get Eclipse to recognize it using that approach.

________________________________________

Now (in Eclipse) you can use the menu bar to create a [File], the [New], then [Project], then [Android Project].….workspace and so forth…

See http://developer.android.com/guide/developing/projects/projects-eclipse.html#CreatingAProject

*** Next problem…In Eclipse Indigo… Make sure in the menu bar…

[Window], then [Preferences], then [Android] …put the drive and directory path to “android-sdk-windows ” which should have the “tools” folder under it… Now Eclipse can see the various Android emulator versions that you have downloaded from the earlier work in the SDK AVD Manager.

Now the “Build Targets” area has choices to pick from.

Eclipse Ver3.7 Indigo New Android Project With Build Target Android Versions Avail

Eclipse Ver3.7 Indigo New Android Project With Build Target Android Versions Available

*** If you are creating a new android project… A common error is leaving the “Package Name” blank.  The second error is giving it a simple name… You will likely get an error… “Package name must have at least two identifiers.”

You make a correct Package … evidently… by …

If your project name was “NewProject1”, the Package name would be “com.android.NewProject1”

___________________________________

*** Another issue…  You get the java compiled without errors and you “Run” an “Android Application”

and it tries to launch and the 5554 Emulator pop up starts and has “Android_” text and then Android in fancy font and seemingly stalls (often without errors) … and you see this on the lower “console” area of Eclipse.

[2011-06-27 21:01:13 – Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout] ——————————
[2011-06-27 21:01:13 – Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout] Android Launch!
[2011-06-27 21:01:13 – Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout] adb is running normally.
[2011-06-27 21:01:13 – Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout] Performing com.android.Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout.Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayoutActivity activity launch
[2011-06-27 21:01:13 – Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout] Automatic Target Mode: launching new emulator with compatible AVD ‘Android_2_2_api8_AVD’
[2011-06-27 21:01:13 – Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout] Launching a new emulator with Virtual Device ‘Android_2_2_api8_AVD’
[2011-06-27 21:01:23 – Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout] New emulator found: emulator-5554
[2011-06-27 21:01:23 – Android2_2_Proj4_Add2NumbersHVGAAbsoluteLayout] Waiting for HOME (‘android.process.acore’) to be launched…
____________
From reading  Google posts, it seems that it’s not uncommon, to have to hit the Run button a second time in Eclipse if the emulator gets stuck trying to launch, install and run the .apk

**** To turn on line numbers in Eclipse

Eclipse Window Preferences General Editors TextEditors LineNumbers

Eclipse Window Preferences General Editors TextEditors LineNumbers

**** Now I’m stuck trying to get button click events to work without crashing.  The xml gui looks fair but crashes on a button click.

Android 2_2_proj4 Initial Screen

Android2_2_proj4 Initial Screen

Then the “Application stopped unexpectedly” on a button click.

Application Stopped Unexpectedly Button Click

Application Stopped Unexpectedly Button Click

______

The google posts recommend using LogCat in Eclipse to troubleshoot weird errors like this that occur in runtime and may involve the emulator start.

First, add this to the import list at the top of the Java code in Eclipse:

import android.util.Log;
//import android.util.Log;

I add it again as a comment because… When you hit <shift> <ctrl> O and let Eclipse auto add import statements because it often

will delete unused or what it thinks are unneeded imports.

Second, to get the LogCat showing as a console at the bottom of Eclipse, click [Window], then [Show View], then [Other], then [Android] and

[LogCat].

It seems that there is a FATAL exception in main….which is main.xml …..Not sure if it’s in the emulator or versions of Android…or???

I have one app that crashes “Stops Unexpectedly” as you launch it (never even shows the GUI)

and the other launches ok and you see the buttons….but “Stops Unexpectedly” when you click on a button.

Someone has suggested looking at my manifest file ( “Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory.”) for each app….

http://developer.android.com/guide/topics/manifest/manifest-intro.html

Anyone seeing these errors?  Has anyone gotten a complete app example to load, launch and actually run in the emulator without errors?

Dunno

More to come on this as it unfolds.

4 Responses to “Dabbling in Android SDK r11 and Eclipse Ver3.7 Indigo and ADT plug-in”

  1. Nick Portelli Says:

    I can’t get the ADT plugin to install in Eclipse 3.7. Dependency errors left and right.

    • Hmmm Says:

      Installing the ADT within Eclipse worked for me…
      This time I did it from within Eclipse Indigo…Using the menu bar [Help], [Install new software] then you have to supply it a URL that I got from this site for Android developers.

      http://developer.android.com/sdk/eclipse-adt.html#downloading

      Start Eclipse, then select Help > Install New Software….
      Click Add, in the top-right corner.
      In the Add Repository dialog that appears, enter “ADT Plugin” for the Name and the following URL for the Location:

      https://dl-ssl.google.com/android/eclipse/

      Continue following the site steps through 7 and this correctly installs the ADT plug-in into Eclipse Ver 3.7 Indigo IDE. Previously, I tried downloading the ADT separately and I couldn’t get Eclipse to recognize it using that approach.

  2. Tom Says:

    I feel your pain. I’ve been learning the android platform for two years now, and I still spend more time getting the environment to run then I do programming and debugging. After two years you would think Google would get this act together, but instead they just create update that create new bugs. The android site is almost useless in that it is a great reference to a programmer that understands evrything already, but useless for the rest of use. Thank God for the stackoverflow site. The fact that there are tens of thousands of posts on stackoverflow just shows how inadequate the android site is and how messed up this environment is.

  3. Hmmm Says:

    Tom, thanks for your posting. Yes, the stackoverflow site has been huge. I realized that I hadn’t interlinked the other posting about the windows based Bluestack Android emulator. That was a huge breakthrough once you get passed compile issues

Leave a comment