Sunday, September 18, 2011

Tinkering with Android: Help Wanted

I am attempting to study programming in android.
But as early as the Hello World app, I am already stumped. >.<


After following the installation instructions for the Android SDK (I installed Android 3.2 API Level 13), and ADT Plugin for Eclipse (my version's Helios), I then proceeded to the HelloWorld app tutorial.


The first time I run it, I got this from Eclipse console:


[2011-09-17 13:28:46 - Emulator] invalid command-line parameter: Files\Android\android-sdk\tools/emulator-arm.exe.
[2011-09-17 13:28:46 - Emulator] Hint: use '@foo' to launch a virtual device named 'foo'.
[2011-09-17 13:28:46 - Emulator] please use -help for more information


Apparently, the android sdk has a bug for paths which includes spaces. >.< My sdk is installed in "F:\Program Files\Android\android-sdk\". So I manually changed the path from Eclipse in Window->Preferences->Android to "F:\PROGRA~1\Android\android-sdk\".


However, there is another problem:
[2011-09-17 13:58:23 - HelloAndroid] Automatic Target Mode: Preferred AVD 'my_avd' is not available. Launching new emulator.
[2011-09-17 13:58:23 - HelloAndroid] Launching a new emulator with Virtual Device 'my_avd'
[2011-09-17 13:58:55 - HelloAndroid] New emulator found: emulator-5554
[2011-09-17 13:58:55 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2011-09-17 14:00:14 - HelloAndroid] emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity launch'!


So I tried uninstalling EVERYTHING and reinstalling EVERYTHING. T_T And this took almost like forever. T_T


After running the app:
[2011-09-18 05:54:55 - HelloAndroid] ------------------------------
[2011-09-18 05:54:55 - HelloAndroid] Android Launch!
[2011-09-18 05:54:55 - HelloAndroid] adb is running normally.
[2011-09-18 05:54:55 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2011-09-18 05:54:55 - HelloAndroid] Automatic Target Mode: Preferred AVD 'my_avd' is not available. Launching new emulator.
[2011-09-18 05:54:55 - HelloAndroid] Launching a new emulator with Virtual Device 'my_avd'
[2011-09-18 05:55:50 - HelloAndroid] New emulator found: emulator-5554
[2011-09-18 05:55:50 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2011-09-18 06:01:16 - HelloAndroid] HOME is up on device 'emulator-5554'
[2011-09-18 06:01:18 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554'
[2011-09-18 06:01:18 - HelloAndroid] Installing HelloAndroid.apk...
[2011-09-18 06:02:51 - HelloAndroid] Success!
[2011-09-18 06:02:52 - HelloAndroid] Starting activity com.example.helloandroid.HelloAndroid on device emulator-5554


Yay! I got a success message! But when I looked at the emulator: 
Where's the promised Hello, Android string???? T_T
So I thought, the problem might be this:
[2011-09-18 06:16:23 - HelloAndroid] Automatic Target Mode: Preferred AVD 'my_avd' is not available. Launching new emulator.
[2011-09-18 06:16:23 - HelloAndroid] Launching a new emulator with Virtual Device 'my_avd'


The default location for my AVDs is "C:\Documents and Settings\Angelica.BEST\.android\avd" which is a path that contains spaces.
But when I tried changing the default location of the virtual devices by adding ANDROID_SDK_HOME to the environment variables and setting it to "F:\Android"



[2011-09-18 14:58:59 - HelloAndroid] ------------------------------
[2011-09-18 14:58:59 - HelloAndroid] Android Launch!
[2011-09-18 14:58:59 - HelloAndroid] adb is running normally.
[2011-09-18 14:59:00 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2011-09-18 14:59:00 - HelloAndroid] Automatic Target Mode: Preferred AVD 'my_avd' is not available. Launching new emulator.
[2011-09-18 14:59:00 - HelloAndroid] Launching a new emulator with Virtual Device 'my_avd'
[2011-09-18 14:59:36 - HelloAndroid] New emulator found: emulator-5554
[2011-09-18 14:59:36 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2011-09-18 15:01:02 - HelloAndroid] HOME is up on device 'emulator-5554'
[2011-09-18 15:01:02 - HelloAndroid] Uploading HelloAndroid.apk onto device 'emulator-5554'
[2011-09-18 15:01:02 - HelloAndroid] Installing HelloAndroid.apk...
[2011-09-18 15:01:41 - HelloAndroid] Success!
[2011-09-18 15:01:42 - HelloAndroid] Starting activity com.example.helloandroid.HelloAndroid on device emulator-5554
[2011-09-18 15:01:44 - HelloAndroid] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.helloandroid/.HelloAndroid }


And the emulator now looks like this:

Gessshh.. What I am doing wrong?? T_T

5 comments:

  1. gee, you lost me halfway there!
    am not much help when it comes to programming, obviously. :)

    lots of luck!
    i know you can do it!!!!

    ReplyDelete
  2. That's okay. :) I'm just such a beginner in android programming. >.<
    When I tried searching in Google, I found out I'm not the only one having this kind of problem. >.<
    So I hope someday I might be able to solve this.

    Thanks, maiylah!

    ReplyDelete
  3. In Android the app related errors are not printed on console it printed on logcat. please see the logcat for exact errors of your app.

    You can find logcat in eclipse at Window > Show View > Other
    Then expand Android and then select LogCat

    ReplyDelete
  4. the screen is locked,with the mouse click the left lock,hold to the

    right icon ,releaseds the mouse.

    ReplyDelete
  5. Yay! It's now working!

    Anonymous, thanks for the added info! :)

    SleepyAndroid, yep, I finally realized that the screen is locked! Hahaha. >.< Thanks! :)

    Here's my latest post regarding the Hello, Android app: http://angelsalvogomez.blogspot.com/2011/09/tinkering-with-android-hello-android-u.html. :)

    ReplyDelete