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
Recommend
More recommend