Programming with Android: SDK install and initial setup Luca Bedogni Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna
SDK and initial setup: Outline ØToday: How to setup a machine to start developing Android applications An overview of an Android project Some useful tools Your first Android application Maybe on a real device! Luca Bedogni - Programming with Android SDK install and initial setup 2
Two options ØHistorically Android development was in Eclipse ØDownload the SDK ØInstall the Android plugin ØNow there is Android Studio ØCustomized environment Luca Bedogni - Programming with Android SDK install and initial setup 3
Which one? ØFor LAM, it s the same ØIf you already use and love Eclipse, go with it ØYou might see examples done in both platforms ØYou can always import an Eclipse project into Android Studio ØThe inverse is difficult Luca Bedogni - Programming with Android SDK install and initial setup 4
Android Studio Luca Bedogni - Programming with Android SDK install and initial setup 5
Where and how to get it ØGo to http://developer.android.com/sdk/installing/studio.html ØDownload Android Studio and the SDK ØInstall it and you re done! Luca Bedogni - Programming with Android SDK install and initial setup 6
Basic requirements ØHow to develop Android applications? ØLinux/Mac OS X/Windows? Doesn t matter ØA real device is not mandatory ØCode your application in the IDE ØTest it with the emulator ØDeploy it on a real device Luca Bedogni - Programming with Android SDK install and initial setup 7
SDK tools Ø Android tool Ø Used to get APIs and add-ons Ø You can also start it from Android Studio Luca Bedogni - Programming with Android SDK install and initial setup 8
SDK tools Ø Android tool Ø Used to get APIs and add-ons Ø You can also start it from Android Studio Luca Bedogni - Programming with Android SDK install and initial setup 9
SDK tools Ø Android tool Ø Used to get APIs and add-ons Ø You can also start it from Android Studio Luca Bedogni - Programming with Android SDK install and initial setup 10
Your first Android application ØGo to File > New Project Luca Bedogni - Programming with Android SDK install and initial setup 11
Your first Android application ØGo to File > New Project Luca Bedogni - Programming with Android SDK install and initial setup 12
Your first Android application ØGo to File > New Project Luca Bedogni - Programming with Android SDK install and initial setup 13
Your first Android application ØGo to File > New Project Luca Bedogni - Programming with Android SDK install and initial setup 14
Your first Android application Luca Bedogni - Programming with Android SDK install and initial setup 15
Testing on the emulator ØSelect Run > Run App Luca Bedogni - Programming with Android SDK install and initial setup 16
Creating an emulator Ø Can configure several options Ø You can create as many as you want Luca Bedogni - Programming with Android SDK install and initial setup 17
Did everything went fine? Ø Test in on the emulator Ø You should see something similar to this Luca Bedogni - Programming with Android SDK install and initial setup 18
Hello world, Android! ØAnatomy of an application ØActivity: what is started ØView: what is seen ØIntent: how to communicate with others ØMix of XML and Java ØGenerally XML for layouts ØJava for the app logic Luca Bedogni - Programming with Android SDK install and initial setup 19
The java and res folders ØAll the code of your application ØThe java folder contains the java code! ØInside res there are a lot of resources ØImages ØLayouts ØXml files ØAndroidManifest.xml Luca Bedogni - Programming with Android SDK install and initial setup 20
AndroidManifest.xml ØMandatory file for every application ØContains: ØApplication declaration ØPermissions ØIntent filters ØTargets Luca Bedogni - Programming with Android SDK install and initial setup 21
How to test ØVia an AVD Ø Fast, possible to have different resolutions, APIs Ø Not a real device ØOn a real device Ø You get exactly what is deployed Ø Must own a real device ØSo? Ø Test in on AVDs. Ø When you feel that the application is ready, go with a real device Luca Bedogni - Programming with Android SDK install and initial setup 22
How to deploy ØAndroid applications must be signed before installing them on a real device Ø Ø Ø You need a key for this and you can generate one from the menu. Luca Bedogni - Programming with Android SDK install and initial setup 23