how to set up eclipse and android sdk manager...

27
How to Set up Eclipse and Android SDK Manager Environment You need to download the following 1. Android Software development Kit (SDK) 2. Eclipse Package 3. Java JDK (if it is not installed on your Windows) First go to http://developer.android.com/sdk/index.html#download to download the Android SDK installer

Upload: duongphuc

Post on 17-Mar-2019

235 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

How to Set up Eclipse and Android SDK Manager Environment

You need to download the following

1. Android Software development Kit (SDK) 2. Eclipse Package 3. Java JDK (if it is not installed on your Windows)

First go to http://developer.android.com/sdk/index.html#download to download the Android SDK installer

Page 2: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

Then click Set Up an Existing IDE on the page

Page 3: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

Click Installing the Eclipse Plugin. Go to Eclipse for Mobile Developers to download the appropriated Eclipse Package

Page 4: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Start Eclipse, then select Help > Install New Software. • Click Add, in the top-right corner. • In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the

following URL for the Location:

https://dl-ssl.google.com/android/eclipse/

Page 5: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Click OK. • In the Available Software dialog, select the checkbox next to Developer Tools and click Next. • In the next window, you'll see a list of the tools to be downloaded. Click Next.

Page 6: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Read and accept the license agreements, then click Finish.

If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.

• When the installation completes, restart Eclipse

Page 7: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

Configure the ADT Plugin

Once Eclipse restarts, you must specify the location of your Android SDK directory as follows:

Windows -> Preference -> Android and specify the full path for SDK (in my case C:\Program Files\Android\android-sdk) SDK Location.

Page 8: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

Your Eclipse IDE is now set up to develop Android apps, but you need to add the latest SDK platform tools and an Android platform to your environment. To get these packages for your SDK, continue to Adding Platforms and Packages.

You might need to download Java Development kit (JDK) if you do not have latest version of it.

• Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html

Page 9: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Download the version for your Windows systems. For 32-bits, download the following and install it.

Set up Android SDK Manager

The ADT bundle with the SDK is sufficient for some basic Apps. But you may install other packages available on the SDK Manager Environment such as

• Samples for SDK • Google Play Services

To install them, open SDK Manager and just click the boxed associated with eh packages and then click Install .. packages. For example, I select 11 packages to install as follows.

Page 10: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Open Eclipse environment

If you get message Fail to Create Java Virtual Machine, open eclipse.ini and delete the default values 256M (or any other values) at lines --launcher.XXMaxPermSize

Page 11: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Specify a local folder for your default Workspace on Workspace Launcher

• Create an Android Application Project via File-> New -> Android Application Project

Page 12: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• In the New Android Application Window, type a project name said, HelloWorld

In the next window, you may specify a location other than your default Workspace in your local folder for easy access of your projects.

Page 13: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient
Page 14: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

You may select Fullscreen Activity

Then you should see on the Eclipse your project similar to

Page 15: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

If you close your project, you can always reopen it File -> Open File

Now, we want modify the project code to output a “Hello World” message. Open the .java source of the project

Change the course as follows Under import statements, add import android.widget.TextView;

Page 16: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

Under setC TextView mymyText.setT setContentV Run the A

To create an A

1. Launa

2. In the3. Fill i

defau4. Click5. Selec6. After

To run the ap

1. Open2. In the

Define an AV

ContentView(

yText = newText("Hello WView(myTex

App on the

AVD:

nch the Androa. In Eclipsee Android Virn the details fult). k Create AVDct the new AVr the emulator

pp from Eclips

n one of your e Run as wind

VD similar to

(R.layout.act

w TextView(tWorld of CGt);

e Emulato

id Virtual Deve, click Andrortual Device Mfor the AVD.

D. VD from the Ar boots up, un

se:

project's filesdow that appe

the following

tivity_fullscr

this); GS3823");

or

vice Manageroid Virtual DeManager paneGive it a nam

Android Virtualock the emul

and click Ruears, select An

g and run the p

reen); add

r: vice Manager

el, click New.me, a platform

al Device Manlator screen.

un from the ndroid Applica

project on it.

r from the

target, an SD

nager and clic

toolbar. ation and clic

toolbar.

card size, and

ck Start.

k OK.

d a skin (HVGGA is

Page 17: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient
Page 18: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

If the running stuck at some activity, right-click the project -> Run as or restart Eclipse

Page 19: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

Creation of .APK distribution of the project for Real Devices To create an .APK distribution for the marketplace, you need to have an Android developer’s account to sign it. Without a developer’s Android account, we can create an .APK distribution in debug mode for debug keystore, which is the same as the marketplace mode. • Check where your keystone is located, via Windows -> Preference -> Android -> Build, where you

will see the Default debug keystore folder (in my case, C:\Documents and Settings\pbao\.android\debug.keystore).

Page 20: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Then we are going to create the .APK distribution in debug mode as follows.

File->Export->Android->Export Android Application

Page 21: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Specify the project to be exported

Page 22: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Specify your default debug keystore for Android and use password, said, android

Page 23: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• On the next screen, specify an alias, said, androiddebugkey with the same password android.

Page 24: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient
Page 25: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient

• Then specify the name and location of the .APK file and hit Finish; the .APK file will be created.

Page 26: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient
Page 27: How to Set up Eclipse and Android SDK Manager Environmentpolonium.forest.usf.edu/~pbao/3823/09/eclipsSDK.pdf · Set up Android SDK Manager The ADT bundle with the SDK is sufficient