Android Development Environment
http://www.eclipse.org/downloads/
Select Eclipse classic 4.2 for your system whether it be Windows, Linux, or Mac.
Then go to:
http://developer.android.com/sdk/index.html
Where you can find the android sdk, and here for the ndk
http://developer.android.com/tools/sdk/ndk/index.html
Eclipse is the java environment where you can develop your android application, and the ndk and sdk are development kits for c++ and java respectively. Place the ndk and sdk in a development directory of your choosing. Choose a simple file path as you will need to link to these later on.
Now we have to set up eclipse itself for android development. Open eclipse and select a workspace folder.
Installing the ADT Plugin
Follow the instructions located here in order to set up the ADT Pluginhttp://developer.android.com/sdk/installing/installing-adt.html
I’ve summarized the instructions here for convenience:
- In eclipse, select Help > Install New Software
- Click Add in the top right corner
- An add repository window should appear, enter "ADT Plugin" for the name and this as the URL for Location: https://dl-ssl.google.com/android/eclipse/
- click ok, if there is an error try http instead of https
- select the available software and click next, and download the tools that you require for the given api levels.
- restart eclipse when finished with instillation
This is to tell eclipse where to find the development kits
cd /android-sdk/tools/
Once here we need to make some changes to the emulator, current as of July 2012 there is an error caused by an audio memory leak in running the android emulator through eclipse. Thus we have to create a wrapper so that eclipse can run the emulator with a reduced risk of crash.
mv emulator emulator.real
vi emulator
Input the following into the text file
#!/bin/sh
exec /Users/lukchristo/eclipse/android-sdk/tools/emulator.real -noaudio -avd AndroidTest
Additional commands can be found here
http://developer.android.com/tools/help/emulator.html
http://developer.android.com/tools/devices/managing-avds-cmdline.html
./android-sdk-macosx/tools/android list targets
./android-sdk-macosx/tools/android create avd -n MyTestAVD -t 1
Do you wish to create a custom hardware profile [no] no
The AVD devices will be placed in /User/<username>/.android/avd/MyTestAVD
- Select Window > Preferences or Eclipse > Preferences if on Mac OS X
- Select Android
- Find the SDK Location in the top of this main panel and browse to the SDK directory
- Apply, then ok
- Select Window -> Preferences -> Android -> NDK or Select Eclipse -> Preferences -> Android -> NDK if on Mac OS X
- Then locate the NDK directory through browse
Emulation Wrapper
Now browse to the top level folder of your the android sdk. cd /android-sdk/tools/
Once here we need to make some changes to the emulator, current as of July 2012 there is an error caused by an audio memory leak in running the android emulator through eclipse. Thus we have to create a wrapper so that eclipse can run the emulator with a reduced risk of crash.
mv emulator emulator.real
vi emulator
Input the following into the text file
#!/bin/sh
exec /Users/lukchristo/eclipse/android-sdk/tools/emulator.real -noaudio -avd AndroidTest
Additional commands can be found here
http://developer.android.com/tools/help/emulator.html
AVD Command Line Creation
Now to create a Android virtual device we follow the directions here:http://developer.android.com/tools/devices/managing-avds-cmdline.html
./android-sdk-macosx/tools/android list targets
./android-sdk-macosx/tools/android create avd -n MyTestAVD -t 1
Do you wish to create a custom hardware profile [no] no
The AVD devices will be placed in /User/<username>/.android/avd/MyTestAVD
~/.android/avd/
/filepath/android-sdk-macosx/tools/emulator
in order to open the avd
Then once the emulator is open go to
/filepath/android-sdk-macosx/platform-tools/
then run the command
./adb install /filepathtopackage/package.apk
./adb push can be used to push a file from your directory to the device being simulated
./adb push foo.txt /sdcard/foo.txt
./adb pull can be used in the opposite manner to push, retrieving a file from the device being simulated
ADB Install and Commands
In the case where you want to install a package onto the emulator, first open the emulator. You can do this from either command line or from eclipse. From the command line run/filepath/android-sdk-macosx/tools/emulator
in order to open the avd
Then once the emulator is open go to
/filepath/android-sdk-macosx/platform-tools/
then run the command
./adb install /filepathtopackage/package.apk
./adb push can be used to push a file from your directory to the device being simulated
./adb push foo.txt /sdcard/foo.txt
./adb pull can be used in the opposite manner to push, retrieving a file from the device being simulated
No comments:
Post a Comment