Thursday, January 23, 2014

Using Android Virtual Device (AVD) Emulator on Linux

Scenario: under Linux, setup Android SDK, to be able to use an AVD (android virtual device) to test any given .apk - without using an IDE like Eclipe.

Preparing the system

# cd /opt (or any preferred install directory)
# wget ADT_DOWNLOAD_LINK
# unzip ADT_VERSION.zip
# chown -R your_user.your_user adt-bundle-linux-SYSTEM-VERSION

# ln -sf /opt/adt-bundle-linux-SYSTEM-VERSION/sdk/platform-tools/adb /usr/local/bin/adb
# ln -sf /opt/adt-bundle-linux-SYSTEM-VERSION/sdk/tools/emulator /usr/local/bin/emulator
# ln -sf /opt/adt-bundle-linux-SYSTEM-VERSION/sdk/tools/android /usr/local/bin/android


Using SDK GUI


$ android
will open SDK manager - use it if you want to install additional packages, including other targets/android versions for AVDs.

$ android avd
will open virtual devices manager - use to create/define/remove AVDs


Note 1
One may face difficulties to add specific brand emulators (ex: Samsung Galaxy S, Galaxy Tab, etc); you'll need to:
a) SDK manager > tools > manage add-on sites > user defined sites > new
OR
b) unzip/uncompress a downloaded add-on package in a new directory under sdk/add-ons/
(ref: http://developer.samsung.com/android/tools-sdks/Samsung-GALAXY-Tab-Emulator)


Note 2
AVDs do not support WiFi emulated connections, only 3G - so if you need to test i.e. a different behavior, likely your only option is to use a real/physical device
(ref: http://stackoverflow.com/questions/7876302/enabling-wifi-on-android-emulator)


Note 3
AppInventor 2 requires WiFi to work with the "MIT AI2 Companion" app (that syncronizes AppInventor with a device)


Note 4
By Jan/2014 AI2 doesn't support emulators under Linux, but to test your AppInventor .apk on an AVD, you can:
$ adb install your_package.apk (1st time)
$ adb install -r your_package.apk (when reinstalling)


Refs:
http://developer.android.com/tools/devices/managing-avds-cmdline.html
http://developer.android.com/tools/devices/emulator.html

No comments:

Post a Comment

deixe sua opinião