Saturday, August 27, 2011

Android Emulator and Eclipse

Last year, I bought Google Nexus One to use as my first smartphone. I chose Android over Iphone because it is easier for a casual developer like me to build an application with the current environment (windows and linux). Also, I would better stick with my comfortable programming language, Java.

After getting a phone, I've developed a simple application to help me generate my password for everything. Yes (Nerd Alert!!), I come up with my own algorithm to generate a password from a specific keyword. Therefore, I just need to choose an obvious and easy-to-remembered keyword. Moreover, I can use a different keyword for a different place/websites. For example, the word "Whitehouse" would generate a password "9jk7Gk62". The real algorithm is nothing much; it is built from a simple encryption algorithm, called "ceasar cipher", a bit operation, and a simple hash function.


Password Generator Application on Motorola Atrix 4g


After a long introduction, there is noting wrong with an application. The problem is when I got a new smartphone (Motorola Atrix 4g). The password generator application is working fine, but the screen size of the application is wrong because Atrix has a better resolution than Nexus One. I have to reinstall ADT Plugin for Eclispe and AndroidSDK. After open a project in Eclipse, I cannot start an emulator. The error in the console is


invalid command-line parameter: Files
Hint: use '@foo' to launch a virtual device named 'foo'.
please use -help for more information


After google to find the solution, from many sites[1,2,3], the problem is with R12 SDK. It doesn't allow space in SDK path. But, if you use AndroidSDK windows installer like me, normally default path is "c:\Programs file\android". First, I tried to change the path in the Eclipse configuration from "c:\Program files\android" to "c:\Progra~1\android". This doesn't work for me since Eclipse will tell me that the directory isn't existed. So, The solution for me is to reinstall an AndroidSDK to a location with out space such as "c:\android". This is definitely a bug!!!

Resources:

[1] - http://www.android.net/forum/beginning-developers/62877-invalid-command-line-parameter-eclipse-android.html

[2] - http://www.wallpaperama.com/forums/_wlxpee.html
[3] - http://stackoverflow.com/questions/6638713/android-emulator-is-not-starting-showing-invalid-command-line-parameter