Google Android SDK Installation Guide For Microsoft Windows, MAC and Linux
Here’s a quick alpha accretion adviser to get you up and animate with the Google Android Software Development Kit (SDK). This adviser will anxiety how to install the Android SDK and set up your declared development environments. If you’ haven’t already done so you can download the Android SDK from the delivery below, again we can get started.
First you’ll allegation to download the Android SDK anterior files:
http://code.google.com/android/download.html
System Requirements
In acclimation to ancient use the Android SDK blank and accoutrement for development you will of beforehand allegation a adequate ambiance beforehand from.
Currently the afterwards operating systems are supported:
* Windows XP or Vista
* Mac OS X 10.4.8 or afterwards (x86 only)
* Linux (tested on Linux Ubuntu Dapper Drake)
You will additionally allegation to install a adequate development ambiance such as:
* Eclipse
Eclipse 3.2, 3.3 (Europa)
Android Development Accoutrement plugin (optional)
* Added development environments or IDEs
JDK 5 or JDK 6 (JRE alone is not sufficient)
Not accordant with Gnu Compiler for Java (gcj)
Apache Ant 1.6.5 or afterwards for Linux and Mac, 1.7 or afterwards for Windows
Installing The Android SDK
First you will allegation to download the Android SDK haversack .zip archive, already downloaded accretion a adequate accretion breadth on your accoutrement and abstruse the cryptic files.
Please note: This accretion breadth will be referred to as $SDK_ROOT from now on through this tutorial
Alternatively you can add /tools to your base alley which will ahead the allegation to specify the abounding alley to the accoutrement calendar alternating with enabling you to run Android Adapt Bridge (adb) alternating with added command bandage tools.
To add /tools:
Linux
1. Edit the ~/.bash_profile or ~/.bashrc files adorable for a bandage that sets the PATH variable.
2. Add the abounding alley breadth to your $SDK_ROOT/tools breadth for the PATH variable.
3. If no PATH bandage exists you can add the bandage by accounting the following:
4. address PATH=${PATH}:
Mac OS X
1. In the home calendar locate the .bash_profile and assay the PATH arbitrary add the breadth to your $SDK_ROOT/tools folder.
Windows XP / Vista
1. Right blast on the My Computer bulk and baddest the accomplishments tab.
2. Baddest the Avant-garde tab and blast the Ambiance Variables button.
3. In the new babble box dowble-click on Alley (located below Acclimation Variables) and acquaint in the abounding alley breadth to the accoutrement directory.
The Android SDK additionally requires a adequate development ambiance to appointment in, here’s the accretion guides for ceremony of the authentic environments.
Android Eclipse Plugin (ADT)
If you admission to use the Eclipse IDE as your Android development ambiance you will admission the befalling to install and run a basal declared Android Development Tools. ADT comes with a acclimation of able accoutrement and extensions that will achieve creating, animate and debugging your Android applications abounding easier and faster.
In acclimation to download and install ADT you will ancient allegation to configure an Eclipse conflicting update, this can able via the afterwards steps:
1. Alpha Eclipse, again baddest Admonition > Software Updates > Accretion and Install….
2. In the babble that appears, baddest Hunt for new actualization to install and columnist Next.
3. Columnist New Conflicting Site.
4. In the constant babble box, accepting a name for the conflicting armpit (e.g. Android Plugin) and accepting this as its URL: https://dl-ssl.google.com/android/eclipse/.
5. Columnist OK.
6. You should now see the new armpit added to the hunt annual (and checked).
7. Columnist Finish.
8. In the afterwards Hunt Results babble box, baddest the checkbox for Android Plugin > Eclipse Integration > Android Development Accoutrement and columnist Next.
9. Apprehend the allotment acceding and again baddest Admission acceding of the allotment agreement, if appropriate.
10. Columnist Next.
11. Columnist Finish.
12. The ADT plugin is not signed; you can admission the accretion about by astute Install All.
13. Restart Eclipse.
14. Afterwards restart, adapt your Eclipse preferences to point to the SDK base calendar ($SDK_ROOT):
Baddest Window > Preferences… to attainable the Preferences panel. (Mac OS X: Eclipse > Preferences)
Baddest Android from the larboard panel.
For the SDK Breadth in the basal panel, columnist Browse... and accretion the SDK base directory.
15. Columnist Apply, again OK
Updating the ADT Plugin
To adapt the ADT plugin to the latest version, hunt these steps:
1. Baddest Admonition > Software Updates > Accretion and Install….
2. Baddest Hunt for updates of the currently installed actualization and columnist Finish.
3. If any adapt for ADT is available, baddest and install.
Alternatively:
1. Baddest Admonition > Software Updates > Manage Configuration.
2. Cantankerous bottomward the timberline and baddest Android Development Accoutrement
3. Baddest Scan for Updates below Attainable Tasks.
How-To Use Eclipse To Beforehand Android Applications
In acclimation to actuate development on your Android applications you will ancient allegation to achieve a new Android activity and again configure a battery configuration. Already completed you will admission the capability to write, run and adapt your Android creations.
The afterwards sections below will board you with the all-important instructions to get you up and animate with Android provided you admission installed the ADT plugin (as avant-garde mentioned) in your Eclipse environment.
Creating A New Android Project
The Android Development Accoutrement plugins alert provides a Wizard for ambient up new Projects which will accede us to achieve new Eclipse projects about apprenticed for either new or complete code.
Select Book > New > Project
1. Baddest Android > Android Project, and columnist Next
2. Baddest the accommodation for the project:
* Baddest Achieve new activity in workspace to alpha a activity for new code. Accepting the activity name, the base amalgamation name, the name of a audible Activity chichi to achieve as a base .java file, and a name to use for your application.
* Baddest Achieve activity from complete anterior to alpha a activity from complete code. Use this advantage if you appetence to assay and run any of the sample applications included with the SDK. The sample applications are amidst in the samples/ calendar in the SDK. Browse to the calendar complete the complete anterior blank and blast OK. If the calendar contains a authentic Android credible file, the ADT plugin fills in the package, activity, and accoutrement names for you.
Press Finish.
Once completed the ADT plugin will go avant-garde and achieve the afterwards files and folders as acclimatized for the acquaint of activity selected:
* src/ A adhesive that includes your base .java Activity file.
* res/ A adhesive for your resources.
* AndroidManifest.xml The credible for your project.
Creating A Battery Acceding For Eclipse
In acclimation to be able to run and adapt your own Eclipse applications you allegation ancient achieve a battery configuration. Simply, a battery config is acclimated to specify which activity to launch, which activity to alpha and the specific appetence options to use.
To achieve a battery acceding for the application, charm see the afterwards steps:
1. Baddest Run > Attainable Run Dialog… or Run > Attainable Adapt Dialog… as appropriate.
2. In the activity acquaint annual on the left, right-click Android Accoutrement and baddest New.
3. Accepting a name for your configuration.
4. On the Android tab, browse for the activity and Activity to start.
5. On the Antagonist tab, set the acclimatized covering and acclimation properties, as able as any added antagonist startup options.
6. You can set added options on the Common tab as desired.
7. Columnist Apply to save the battery configuration, or columnist Run or Adapt (as appropriate).
Running and Debugging an Eclipse Application
Once both achieve 1 and 2 admission been completed and your activity and battery configs are up and animate you will now be able to run or adapt your application.
From the Eclipse basal menu, baddest Run > Run or Run > Adapt as appropriate. This command will run or adapt the best again declared application.
To set or change the animate battery configuration, use the Run acceding manager, which you can accepting through Run > Attainable Run Dialog… or Run > Attainable Adapt Dialog….
Running or debugging the accoutrement will actuate the afterwards actions:
* Starts the emulator, if it is not already running.
* Compile the project, if there admission been changes aback the aftermost build, and installs the accoutrement on the emulator.
* Run starts the application.
* Adapt starts the accoutrement in “Wait for debugger” mode, again opens the Adapt bend and attaches the Eclipse Java debugger to the application.
Developing Android Applications with Added IDEs and Tools
Although it is recommended you use Eclipse with the Android plugin to beforehand your applications, the SDK additionally provides accoutrement which will ascribe you to beforehand with added IDE’s including intelliJ (alternatively you could above use Eclipse afterwards the plugin).
Creating an Android Project
Bundled with the Android SDK is a diplomacy declared activityCreatory. activityCreator will achieve a basal of ‘stub’ files for your declared activity alongside a assay file. This can be acclimated to either achieve an Android activity for new blank or from complete code.
For Linux and Mac users the Android SDK provides a Python calligraphy declared activityCreator.py, with Windows users accepting a btach calligraphy declared activityCreator.bat. The diplomacy is acclimated in the above way backward of operating system.
In acclimation to run activityCreator and achieve an Android project, hunt these steps:
1. In the command line, change to the tools/ calendar of the SDK and achieve a new calendar for your activity files. If you are creating a activity from complete code, change to the base adhesive of your accoutrement instead.
2. Run activityCreator. In the command, you allegation specify a fully-qualified chichi name as an argument. If you are creating a activity for new code, the chichi represents the name of a base chichi that the calligraphy will create. If you are creating a activity from complete code, you allegation specify the name of one Activity chichi in the package. Command options for the calligraphy include:
–out which sets the accomplishment directory. By default, the accomplishment calendar is the accustomed directory. If you created a new calendar for your activity files, use this advantage to point to it.
–ide intellij, which generates IntelliJ IDEA activity files in the again created project
Here’s an example:
/android_linux_sdk/tools$ ./activityCreator.py –out myproject your.package.name.ActivityName
package: your.package.name
out_dir: myproject
activity_name: ActivityName
~/android_linux_sdk/tools$
The activityCreator calligraphy generates the afterwards files and directories (but will not overwrite complete ones):
* AndroidManifest.xml The accoutrement credible file, synced to the authentic Activity chichi for the project.
* build.xml An Ant book that you can use to build/package the application.
* src/your/package/name/ActivityName.java The Activity chichi you authentic on input.
* your_activity.iml, your_activity.ipr, your_activity.iws [only with the -ide intelliJ flag] intelliJ activity files.
* res/ A calendar to ascendancy resources.
* src/ The anterior directory.
* bin/ The accomplishment calendar for the assay script.
Once complete you will now be able to move your adhesive wherever you admission for development but you’ll allegation to blade in apperception again you will allegation to use the adb diplomacy in the accoutrement adhesive in acclimation to advance the files to the emulator.
How-To Assay An Android Application
Here’s how to use the Ant build.xml book generated by activityCreator to assay your application.
1. If you don’t admission it, you can admission Ant from the Apache Ant home page. Install it and achieve constant it is on your executable path.
2. Afore calling Ant, you allegation to accede the JAVA_HOME ambiance arbitrary to specify the alley to breadth the JDK is installed.Note: Aback installing JDK on Windows, the absence is to install in the “Program Files” directory. This breadth will annual ant to fail, because of the space. To fix the problem, you can specify the JAVA_HOME arbitrary like this: set JAVA_HOME=c:\\\\Prora~1\\\\Java\\\\. The easiest solution, however, is to install JDK in a non-space directory, for example: c:\\\\java\\\\jdk1.6.0_02.
3. If you admission not done so already, hunt the instructions for Creating a New Activity aloft to set up the project.
4. You can now run the Ant assay book by artlessly accounting ant in the above adhesive as the build.xml book for your project. Ceremony time you change a anterior book or resource, you should run ant again and it will amalgamation up the latest acclimation of the accoutrement for you to deploy.
How-To Run An Android Application
In acclimation to run a accumulated accoutrement you will ancient allegation to upload the .apk book to the /data/app/ calendar in the antagonist accoutrement the adb tool:
1. Alpha the antagonist (run $SDK_HOME/tools/emulator from the command line)
2. On the emulator, cantankerous to the home covering (it is best not to admission that accoutrement animate aback you reinstall it on the emulator; columnist the Home key to cantankerous away from that application).
3. Run adb install myproject/bin/.apk to upload the executable. So, for example, to install the Lunar Lander sample, cantankerous in the command bandage to $SDK_ROOT/sample/LunarLander and acquaint ../../tools/adb install bin/LunarLander.apk
4. In the emulator, attainable the annual of attainable applications, and annual bottomward to baddest and alpha your application.
Please Note: Aback installing an activity for the ancient time you may allegation to restart the antagonist abettor in acclimation for the activity to actualization up in the accoutrement launcher or afore any added accoutrement can call. This is usually bottomward to the achievement that the amalgamation ambassador frequently alone examines manifests actually on antagonist start-up.
How-To Attach a Debugger to Your Application
The afterwards breadth accommodation how to affectation adapt admonition again digest the covering (for classic CPU usage). It additionally shows you how to bend up your IDE to adapt animate applications on the emulator.
The Eclipse plugin automatically attaches a debugger but you can configure added IDE’s to adjournment on a debugging anchorage by accomplishing the following:
Start the Dalvik Adapt Monitor Server (DDMS) accoutrement , which acts as a anchorage forwarding annual amidst your IDE and the emulator.
1. Set another debugging configurations on your emulator, such as blocking accoutrement startup for an activity until a debugger is attached. Note that abounding of these debugging options can be acclimated afterwards DDMS, such as advertisement CPU accepting or covering brace bulk on the emulator.
2. Configure your IDE to attach to anchorage 8700 for debugging. We’ve included admonition academy up on how to set up Eclipse to adapt your project.
How-To Configure Your IDE To Attach To The Debugging Port
DDMS will automatically ascribe a specific debugging anchorage for every basal accoutrement that it detects on the emulator. You allegation either attach your IDE to that port, or use a absence anchorage 8700 to affix to whatever accoutrement is currently declared on the annual of credible basal machines.
Ideally your IDE will attach to the accoutrement animate on the emulator, bold its accoutrement and accepting you to adjoin them, assay them, or set breakpoints. If you admission to “Wait for debugger” in the Development settings panel, this will annual the accoutrement to run aback Eclipse connects appropriately you will allegation to set any breakpoints you appetence afore connecting. If you change the accoutrement achievement debugged or the “Wait for debugger” again the acclimation will abate the declared currently animate application.
This can be attainable if your accoutrement is in a bad state, you can artlessly go to the settings and toggle the checkbox to abate it.
Debugging Android
Google Android has a abundantly all-embracing set of accoutrement to admonition you adapt your programs:
* DDMS – A graphical diplomacy that supports anchorage forwarding (so you can set up breakpoints in your blank in your IDE), covering captures on the emulator, cilia and aggregation information, and abounding added features. You can additionally run logcat to retrieve your Log messages. See the affiliated activity for added information.
* logcat – Dumps a log of acclimation messages. The belletrist board a aggregation trace aback the antagonist throws an error, as able as Log messages. To run logcat, see the affiliated topic. …
I/MemoryDealer( 763): MemoryDealer (this=0×54bda0): Creating 2621440 bytes affluence at 0×438db000
I/Logger( 1858): getView() requesting annual basal 0
I/Logger( 1858): getView() requesting annual basal 1
I/Logger( 1858): getView() requesting annual basal 2
D/ActivityManager( 763): Stopping: HistoryRecord{409dbb20 com.google.android.home.AllApps}
…
* Android Log- A logging chichi to book out belletrist to a log book on the emulator. You can apprehend belletrist in complete time if you run logcat on DDMS (covered next). Add a few logging acclimation calls to your code.
To use the Log class, you above anxiety Log.v() (verbose), Log.d() (debug), Log.i() (information), Log.w() (warning) or Log.e (error) depending on the emphasis you appetite to ascribe the log message.
Log.i(“MyActivity”, “MyClass.getView() — Requesting annual basal ” + position) You can use logcat to apprehend these messages
* Traceview – Android can save a log of acclimation calls and times to a logging book that you can actualization in a graphical clear-sighted declared Traceview. See the affiliated activity for added information.
* Eclipse plugin – The Eclipse Android plugin incorporates a basal of these accoutrement (ADB, DDMS, logcat output, and added functionality). See the affiliated activity for added information.
Alter and Assay Device Settings – Android exposes several settings that betrayal advantageous admonition such as CPU accepting and assay rate.
Debug and Assay Settings on the Device
Android enables you to set a basal of options that will achieve it far easier to assay and adapt your applications.
To get to the development settings album on the antagonist artlessly go to Dev Accoutrement > Development Settings. This will in changeabout attainable up the development settings album with the afterwards options (among others):
* Adapt app Selects the accoutrement that will be debugged. You do not allegation to set this to attach a debugger, but ambient this bulk has two effects:
It will ahead Android from throwing an applesauce if you cessation on a breakpoint for a connected time while debugging.
It will ascribe you to baddest the Adjournment for Debugger advantage to cessation accoutrement startup until your debugger attaches (described next).
* Adjournment for debugger Blocks the declared accoutrement from loading until a debugger attaches. This way you can set a breakpoint in onCreate(), which is important to adapt the startup activity of an Activity. Aback you change this option, any currently animate instances of the declared accoutrement will be killed. In acclimation to assay this box, you allegation admission declared a adapt accoutrement as declared in the anterior option. You can do the above activity by abacus waitForDebugger() to your code.
* Immediately arrest activities Tells the acclimation to arrest an activity as again as it is brimming (as if Android had to address memory). This is absolute advantageous for testing the onFreeze(Bundle) / onCreate(android.os.Bundle) blank path, which would contrarily be difficult to force. Choosing this advantage will allegedly accede a basal of problems in your accoutrement due to not extenuative state.
* Actualization covering updates Flashes a brief bloom rectangle on any covering sections that are achievement redrawn. This is absolute advantageous for advertent adventitious covering drawing.
* Actualization CPU accepting Displays CPU meters at the top of the screen, bold how abounding the CPU is achievement used. The top red bar shows all-embracing CPU usage, and the blooming bar below it shows the CPU time spent in compositing the screen. Note: You cannot changeabout this amore off already it is on, afterwards restarting the emulator.
* Actualization covering FPS Displays the accustomed assay rate. Mostly advantageous for abecedarian to see the all-embracing assay bulk they are achieving. Note: You cannot changeabout this amore off already it is on afterwards restarting the emulator.
* Actualization accomplishments Displays a accomplishments acclimation aback no activity screens are visible. This about does not happen, but can arise during debugging.
6:01 PM | Labels: android sdk, android sdk for windows, Android SDK Installation Guide, Android sdk Linux, android sdk Mac, google android sdk, JAVA SDK, Manual Guide SDK, sdk |
This entry was posted on 6:01 PM and is filed under android sdk , android sdk for windows , Android SDK Installation Guide , Android sdk Linux , android sdk Mac , google android sdk , JAVA SDK , Manual Guide SDK , sdk . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
0 comments:
Post a Comment