The following article has been adapted from the original by Çiğdem Avcı. You can find the original (Turkish) article here.
Let’s try Android on Ubuntu! For this, you must have Java environment installed. After we download the Android SDK (http://developer.android.com/sdk/index.html), we unpack the archive with the following command:
tar -xzvf android-sdk_r3-linux.tgz
The archive has been extracted into android-sdk-linux
folder. Since the Android tools are under android-sdk-linux/tools
, we set the PATH
variable to include that folder.
PATH=${PATH}:~/android-sdk-linux/tools
export PATH
To see what’s inside the PATH variable, we type
echo $PATH
We make sure that the path which contains android-sdk-linux/tools
is correct. For our experiments, we have created a separate folder named android
. We will continue working in this folder. First, we navigate to this folder from the terminal.
cd android
Next, we start producing virtual phones (AVD – Android Virtual Device). Let’s create a virtual SD-Card (Secure Digital Memory Card).
mksdcard 2048M SDCARD
And now, let’s create a virtual phone.
android create avd -n CGDM_PHONE -t 2
Failed. We get an error:
Error: Target id is not valid. Use 'android list targets' to get the target ids.
We do that to see the list.
android list targets
We don’t see any lists. Maybe, we missed to install something. Let’s install if there are any updates or revisions.
android
We can’t connect to the URL shown on the UI. We check the “force https connection” under “Settings”. Under available packages
, we start downloads related to android 2.0
which we think might be necessary. After the installation is complete, we try to create our virtual phone again.
android create avd -n CGDM_PHONE -t 2
Android 1.6 is a basic Android platform.
(We press enter here)
Do you wish to create a custom hardware profile [no]
Created AVD 'CGDM_PHONE' based on Android 1.6, with the following hardware config:
hw.lcd.density=160
This time it worked. Now, let’s run the emulator.
emulator @CGDM_PHONE -sdcard SDCARD
Whoa! 🙂 There comes the virtual phone.
Up to this point, we learned to prepare the emulator environment. We’ll learn to use it later.
Happy coding!
Special thanks to my dear friend, Çiğdem Avcı for letting me publish her article here.