A Tutorial on Building the Android

idleheadedceleryMobile - Wireless

Dec 10, 2013 (3 years and 4 months ago)

56 views

A Tutorial on Building the Android
Development Environment

Revision History



4th Version
: January 24, 2012 (by
Joongheon Kim
),
Typo correcting and simplification



3rd Version
: January 13, 2012 (by
Joongheon Kim
),
SDK Version 4.0+



2nd Version
: August 16, 2012 (by
Joongheon Kim
)



Initial Version
: May 22, 2010 (by
Joongheon Kim
)

1

Joongheon

Kim

Web:
http://sites.google.com/site/joongheon

E
-
mail:
joongheon.kim@usc.edu


Department of Computer Science, USC
Viterbi

School of Engineering

Los Angeles, California, USA

EE
-
579

Wireless and Mobile Networks Design and Laboratory (Spring 2013)

Professor

Murali

Annavaram

JDK

Android SDK

Eclipse

Table of Contents

2

Hello World

Building
Development
Environment

Programming
Start Tips

Building
Development
Environment

JDK

Android SDK

Eclipse

Table of Contents

3

Programming
Start Tips

Hello World

Building Development Environment:
JDK

Java SE Development Kit (JDK)




Programming on Google Android and AppEngine is based on Java.



Download the JDK from the Internet (It will be updated, automatically.).

Cf. I am using the Microsoft Windows Vista (win32) machine.

4

Step #1



Making a new folder, named “Android” in C (

C:
\
Android
”)



Save the downloaded JDK (e.g.,
jdk
-
6u11
-
windows
-
i586
-
p.exe
) in the



C:
\
Android
”.



Download from the
Internet



Double Click the JDK and install (Keep pressing “next”).

Building
Development
Environment

JDK

Android SDK

Eclipse

Table of Contents

5

Programming
Start Tips

Hello World

Building Development Environment:
Android SDK

6

Step #1



Go to
http://developer.android.com/sdk/index.html



Click “
Download the SDK
”.

(The android developer page on January 12, 2013)

Building Development Environment:
Android SDK

7

Step #2



In the next page, check in the “
agree
” box and press “
download
”.











Put

the downloaded
SDK (zip format:
adt
-
bundle
-
windows
-
x86.zip
)



into “
C:
\
Android
”. (if your machine is 64
-
bit, you have to select the other one)



Unzip

the SDK.



Making a “
workspace
” folder within the “
adt
-
bundle
-
windows
-
x86
” folder.

Building Development Environment:
Android SDK

8

Step #3



Then, the
current folder structure

is as follows:

C

Android

adt
-
bundle
-
windows
-
x86

eclipse

sdk

workspace

SDK Manager

JDK

Android SDK

Eclipse

Table of Contents

9

Building
Development
Environment

Programming
Start Tips

Hello World

Building Development Environment:
Eclipse

10

Step #4

Downloaded “adt
-
bundle
-
windows
-
x86” already has Eclipse.

Thus, we do not need to separately download the Eclipse any more.



Double click the “
eclipse.exe
” file within “
C:
\
Android
\
adt
-
bundle
-
windows
-
x86
\
eclipse
\




When “
Workspace Launcher
” message box is appeared,


Set the path as “C:
\
Android
\
adt
-
bundle
-
windows
-
x86
\
workspace” using the “
Browse..
” button.



And
press OK
.

Building Development Environment:
Eclipse

11

Android Development Plug
-
In Installation in Eclipse

Step #5



From here, we will start to install the android development plug
-
in in Eclipse
.



After running “Eclipse”, go to
[Help]



[Install New Software]

in the
Eclipse menu
.


Building Development Environment:
Eclipse

12

Android Development Plug
-
In Installation in Eclipse

Step #6



After appearing “
Install
” message box, click the
[Add]

button.

Building Development Environment:
Eclipse

13

Android Development Plug
-
In Installation in Eclipse

Step #7



In the “
Add Repository
” message box, input
http://dl
-
ssl.google.com/android/eclipse/
.



And press
OK
.

Building Development Environment:
Eclipse

14

Android Development Plug
-
In Installation in Eclipse

Step #8



In previous step, after pressing OK, you can see


the following
updated


Install
” message box.

Building Development Environment:
Eclipse

15

Android Development Plug
-
In Installation in Eclipse

Step #9



After clicking
all radio buttons
, click the “
next
” button.

Building Development Environment:
Eclipse

16

Android Development Plug
-
In Installation in Eclipse

Step #10



Press “
Next
” button,


again.

Building Development Environment:
Eclipse

17

Android Development Plug
-
In Installation in Eclipse

Step #11



In the next “
Install
” message box, “
accept
” the license agreements, press “
Finish


Building Development Environment:
Eclipse

18

Android Development Plug
-
In Installation in Eclipse

Step #12



Then, the installation of Android plug
-
in becomes start (ignore warnings and etc).









After finishing the installation, restart by pressing
Yes

in the following message box.








JDK

Android SDK

Eclipse

Table of Contents

19

Building
Development
Environment

Programming
Start Tips

Hello World

Programming Start Tips:
Hello World

20

Step #1



Basic Setting



You have to install
device driver

for the given Android Phone.


(You are able to find it from the Internet or Vendor’s websites.)



In the Android Phone,



Go to



[Settings]


[Developer Options]


[USB debugging]


and
Activate

the
[USB debugging]
.




Go to



[Settings]


[Security]


[Unknown Sources]


and
Activate

the
[Unknown Sources]
.



Programming Start Tips:
Hello World

21

Step #2



Connect the Android Phone to the Development Computer.



Open the Eclipse and go to
[File]



[New]


[Android Application Project]

Programming Start Tips:
Hello World

22

Step #3



In the “
New Android Application
” box, Write the Application Name.



In this example, I wrote “
Test
” as shown in the figure.



Then, click the “
Next
” Button.

Programming Start Tips:
Hello World

23

Step #4



Click the “
Next
” Button.

Programming Start Tips:
Hello World

24

Step #5



Click the “
Next
” Button.

Programming Start Tips:
Hello World

25

Step #6



Click the “
Next
” Button.

Programming Start Tips:
Hello World

26

Step #7



Click the “
Finish
” Button.

Programming Start Tips:
Hello World

27

Step #8



Then, we can see the new generated “
Test
” package.



In the left window, go to
[Test]


[
獲s



[
捯洮數慭灬攮瑥獴



and double click “
MainActivity.java


Programming Start Tips:
Hello World

28

Step #9



Right Click on “Test”

and Go to
[Run As]



[Android Application]
.


Programming Start Tips:
Hello World

29

Step #10



Then, you can see “
Android Device Choose
” box and choose a target device.


(In this example, a “
Samsung
” device is selected). Then Click “
OK
” button.



Then, you can see the message “
Hello World, Test!
” in Android Phone LCD.