• No results found

How To Develop An Android App On An Android Device

N/A
N/A
Protected

Academic year: 2021

Share "How To Develop An Android App On An Android Device"

Copied!
10
0
0

Loading.... (view fulltext now)

Full text

(1)

Lesson 2

Android Development Tools =

Eclipse + ADT + SDK

VictorMatos ClevelandStateUniversity

PortionsofthispagearereproducedfromworkcreatedandsharedbyGoogleandusedaccordingtoterms describedintheCreativeCommons3.0AttributionLicense.

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

• AndroidapplicationsareusuallycreatedusingtheJava programminglanguage[1]

• YourJavaprojectmustimportvariousAndroidLibraries(suchasandroid.jar, maps.jar,etc)togainthefunctionalityneededtoworkinsidetheAndroidOS. • EventhesimplestofAndroidappsiscomposedofseveralelementssuchas:

userͲdefinedclasses,androidjars,thirdͲpartylibraries,XMLfilesdefiningtheUIs orviews,multimediaresources,dataassetssuchasdiskfiles,externalarraysand strings,databases,andfinallyaManifest summarizingthe‘anatomy’and permissionsrequestedbytheapp.

• The package(s) holding the raw app components are given to the compiler toThepackage(s)holdingtherawappcomponentsaregiventothecompilerto obtainasinglesignedanddeployableAndroidPackage(an.apk file).

(2)

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

• Creating,organizingandmanagingthecomponentsofanAndroidappis betterdoneusinga‘friendly’workbench. • TheAndroiddeveloper’sworkbenchtypicallyincludesthefollowingtools: 1 E li IDE 1. EclipseIDE 2. AndroidDevelopmentTools(ADT),and 3. AndroidSystemDevelopmentKit(SDK) • EclipseIDEallowsyoutocreateanddebugyourJavacode,andmanagethe variousresourcesthatnormallyareusedinthemakingofanAndroidapp. • TheADTplugin extendsEclipsesoyoucaneasilyreachthetoolsoftheSDK

(3)

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

TypicalLayoutoftheEclipseIDEforAndroidDevelopment

(details…) Theseicons

areaddedto Eclipsebythe ADT plugin OpensAndroidSDKmanager O d id i l i ADTplugin 5 5 OpensDDMSPerspective Dalvik DebuggingMonitoringSystem

OpensAndroidAVD VirtualDevice Manager

Wizard createsanewAndroidProject

Note:TheDDMS andHierarchyViewcanbemanuallyaddedbytheusertoEclipse’stoolbar

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

SETUP

Prepare

yourcomputer– InstallSDK:Windows,Mac,Linux

(4)

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

Aside

Note:

SDKsarenamedafteradessert item.Availableversionsatthetimeofwriting are: 1.5Cupcake, 1.6Donut, 2.1Eclair, 2.2Froyo, 2.3Gingerbread[1], 3.xHoneycomb, 4.xIceCreamSandwich 7 7 [1]ByMarch2012Gingerbreadaccountedforapproximately66%oftheAndroidmarketshare. Seepage:http://www.appbrain.com/stats/topͲandroidͲsdkͲversions

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

SETUP

(a) UsersWantingtoUpdateanOlderAndroidWorkbench

(5)

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

SETUP

(b)FirstTimeUsers(Windows,Mac,Linux)

1. InstalltheappropriateSDKstarterpackagefromthepage

http://developer.android.com/sdk/index.htmlp // p / /

2. InstalltheADTPlugin forEclipse

1. StartEclipse,thenselectHelp >InstallNewSoftware.... 2. ClickAdd button(topͲrightcorner)

3. InthenextdialogͲboxenter"ADTPlugin"fortheName andthefollowing URLfortheLocation:https://dlͲssl.google.com/android/eclipse/ 4. ClickOK

5 Select the checkbox next toDeveloper Toolsand click Next > Next

9 5. SelectthecheckboxnexttoDeveloperToolsandclickNext > Next

6. Acceptthelicenseagreements,thenclickFinish. 7. AftertheinstallationendyouneedtorestartEclipse. 3. AddAndroidplatformsandothercomponentstoyourSDK(seeprevious option(a)) 9

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

ConfiguringtheADTPlugin ThenextstepistomodifyyourADTpreferencesinEclipsetopointtothe A d id SDK di t AndroidSDKdirectory:

1. Select Window > Preferences... toopenthePreferencespanel (MacOSX: Eclipse > Preferences).

1. Select Android fromtheleftpanel.

2. Tosetthe boxSDKLocationthatappearsinthemainpanel, click Browse... andlocateyourdownloadedSDKdirectory(usually

c:/Program/ g Files(x86)/Android/androidͲsdk( )/ / )) 3. Click Apply,then OK.

(6)

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

CreatinganAndroidVirtualDevice(AVD) Youshouldtestyourapplicationsonarealphone(ortablet). However,theSDKallowsyoutocreaterealisticvirtualdevicesonwhichyour li ti ld b t t d applicationscouldbetested. 1. Tocreateanemulator,clickontheAVDManager 2. Click New.The CreateNewAVD dialogappears. 3. TypethenameoftheAVD,suchas“NexusͲS" 4. Chooseatarget(suchas“GoogleAPIs…APILevel8”). 5. Indicatehowmuchmemorythesimulatorwilluse. 6 Tick option box “Snapshot” to load faster

11 6. Tickoptionbox“Snapshot”toloadfaster.

7. Indicatescreensize(HVGAissufficientingeneral) 8. Optionallyspecifyanyadditionalhardwarecomponents

(suchasSDͲcard,camer,accelerometer,GPS,…) 9. Click CreateAVD.

(7)

2.

DevelopmentEnvironment=Eclipse+ADT+SDK

TestingtheEmulator ClickontheAVDManager.Chooseanemulator,clickStart. 13 13

Android

SetupTutorial

Afteryoucompleteyoursetuplookforthefollowingtwosubdirectoriesin yourfilesystem

C:\Program Files (x86)\Android\android-sdk

(8)

Appendix.

CreatinganAndroidProject

(madeforSDK2.2Ͳ Froyo) Anunabridgedversionof“HelloWorld”

Testing

SetupͲ Example:HelloWorld

15

Testing

SetupͲ Example:HelloWorld

Creating

anAndroidProject

Tocreateanewproject: 1. StartEclipse

2. SelectFile >New >AndroidProject a

ll l 3. EnterProjectname:01ͲHelloͲWorld 4. ClickNext 5. OnSelectBuildTargetchooserow GoogleAPIsGoogleInc.2.28 6. ClickNext 7. OntheApplicationInfoformenter Pacakage Name:csu.matos

CheckboxCreateActivity Activity name: HelloActivity

(9)

OBSERVATION:CreatinganAndroidProjectusingEclipse

TheNewAndroidProjectWizardcreatesthefollowingfoldersandfilesinyournew projectspace:

Testing

SetupͲ Example:HelloWorld

src/IncludesyourskeletonActivityJavafile.AllotherJavafilesforyour applicationgohere.

<AndroidVersion>/(e.g.,Android2.2/)Includestheandroid.jarfilethatyour applicationwillbuildagainst.

gen/ThiscontainstheJavafilesgeneratedbyADT,suchasyourR.javafile • assets/Thisisempty.Youcanuseittostorerawassetfiles.

res/Thisfolderholdsapplicationresourcessuchasdrawable files,layout files, string al es et

17 string values,etc.

bin/Thebytecode (.apk)versionofyourappisstoredhere • AndroidManifest.xmlTheAndroidManifestforyourproject.

default.propertiesThisfilecontainsprojectsettings,suchasthebuildtarget.

Creating

anAndroid

Project

Testing

Setup–

Example:

HelloWorld

Project



Thefollowingfoldersandfiles arecreatedforthe 01ͲHelloͲWorldproject. Totesttheapplication,position thecursoronthecodepanel, andthenclickonthe

(10)

Volume StatusBar– NotificationLine Camera NumericID:5554 Hangup Home Call Power Search 19 19 Back Menu Tab Launch Pad

Android

Emulator

Keyboard OSfunction Escape Backbutton Home Homebutton F2,PageUp Menu(SoftͲLeft)button ShiftͲF2,PageDown Start(SoftͲRight)button F3 Call/Dial button ControllingtheAndroidEmulator through(yourcomputer’s) keyboardkeys

Keypad keys only work when

F3 Call/Dialbutton F4 Hangup/EndCallbutton F5 Searchbutton F7 Powerbutton CtrlͲF3,CtrlͲKEYPAD_5 Camerabutton CtrlͲF5,KEYPAD_PLUS Volumeupbutton CtrlͲF6,KEYPAD_MINUS Volumedownbutton KEYPAD_5 DPadcenter KEYPAD_4 DPadleft KEYPAD_6 DPadright KEYPAD_8 DPad up KEYPAD 2 DP d d Keypadkeysonlyworkwhen NumLockisdeactivated. KEYPAD_2 DPaddown F8 togglecellnetworkon/off

F9 togglecodeprofiling(when Ͳtrace optionset) AltͲENTER toggleFullScreenmode

References

Related documents

-Android Emulator that simulates and runs Android virtual device. -ADT plug-in for

IDIS Mobile for Android is an app for connecting to a device (NVR or network camera) using mobile device running on Android platform and remotely monitoring videos via a

make java documentation android app building game android development nexus 7 2013 android sdk ndk ubuntu android apps development tools how to make calculator app in android

An Android Virtual Device (AVD) defines the hardware the emulator.

Android Setup Tutorial Summary of Android On‐line Installation Resources 0. JAVA http://www.dailymotion.com/video/x77uqg_google‐android‐emulator‐tutorial‐tr_tech

The correlation between the ability to compete for PfMetAP2 binding in the mammalian three-hybrid system and to inhibit malaria growth in vitro is consistent with PfMetAP2 as

The Pathway of Distinction Analysis (PoDA) [8] was applied to the NAFLD genotype data for the following histologic phenotypes: steatohepatitis, NAFLD activity score (NAS) and

• If the tablet is on and the screen is awake, long press the hard power button to invoke the android menu that allows the user to Restart or Power Off the Android