meljun cortes android lecture sdk install
Post on 07-Aug-2018
225 Views
Preview:
TRANSCRIPT
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
1/34
Programming with Android:SDK install and initial setup
MELJUN P. CORTES,MBA,MPA,MSCS in progress
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
2/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
SDK and initial setup: Outline
Today:
How to setup a machine to start developing AndroidapplicationsAn overview of an Android projectSome useful tools
Your first Android application• Maybe on a real device!
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
3/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Two options
Historically Android development was in Eclipse
Download the SDKInstall the Android plugin
Now there is Android Studio You still have to download the SDKCustomized environment
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
4/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Which one?
For the class, 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 AndroidStudioThe inverse is difficult
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
5/34
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
6/34MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Where and how to get it
Go to http://developer.android.com/sdk/installing/studio.html
Download Android Studioand the SDK
Install it and you ’ re done!
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
7/34
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
8/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
SDK tools
Android tool
Used to get APIs
and add-ons
You can also start it
from Android Studio
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
9/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Your first Android application
Go to File > New Project
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
10/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Testing on the emulator
Select “ Launch Emulator ”
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
11/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Creating an emulator
Can configure severaloptions
You can create as manyas you want
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
12/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Did everything went fine ?
Test in on the emulator
You should see something
similar to this
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
13/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Hello world , Android!
Anatomy of an application
Activity: what is startedView: what is seenIntent: how to communicate with others
Mix of XML and JavaGenerally XML for layoutsJava for the app logic
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
14/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Application structure
Even the simplest application
has a lot of filesSome are autogeneratedEach project contains
ActivitiesLayoutsXML files
AndroidManifest.xml
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
15/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
build
Autogenerated files
No need to modify themSome are autogeneratedEach project contains
ActivitiesLayoutsXML files
AndroidManifest.xml
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
16/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
src
All the code of your application
The java folder contains… the java code!Inside res there are a lot ofresources
ImagesLayoutsXml files
AndroidManifest.xml
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
17/34
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
18/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
How to test
Via an AVD
Fast, possible to have different resolutions, APIsNot a real device
On a real deviceYou get exactly what is deployed
Must own a real deviceSo?
Test in on AVDs.When you feel that the application is ready, go with a real device
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
19/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
How to deploy
Android applications must be signed before installing
them on a real device
You need a key for thisand you can generate from the menu.
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
20/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Eclipse
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
21/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
SDK and initial setup: 3 step setup
Download Android SDK for your platform:
http://developer.android.com/sdk/index.html
Execute (and then select the Android API version) :android-sdk-xxx/tools/android
Install the ADT plugin for Eclipse:http://www.eclipse.org/downloads/https://dl-ssl.google.com/android/eclipse
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
22/34
A l i f li
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
23/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
ADT plugin for Eclipse
Useful to run applications via Eclipse, highly
reccomendedGo to http://developer.android.com/sdk/eclipse-adt.htmlPick the repository (actually https://dl-
ssl.google.com/android/eclipse/ ) Add a repository in Eclipse and download the“Developers Tools ”This will make a virtual bridge between eclipse andthe SDK
C P j
http://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttp://developer.android.com/sdk/eclipse-adt.htmlhttps://dl-ssl.google.com/android/eclipse/https://dl-ssl.google.com/android/eclipse/https://dl-ssl.google.com/android/eclipse/https://dl-ssl.google.com/android/eclipse/https://dl-ssl.google.com/android/eclipse/http://developer.android.com/sdk/eclipse-adt.html
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
24/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Create a Project
Create it under Eclipse
Assign an SDK targetChoose an application nameChoose a package nameCreate an activity and assign a name
Run it to test that everything is ok
C AVD
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
25/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Create an AVD
AVD means Android Virtual DevicTest the application before runningon a deviceMultiple APIs → Multiple targets
Makes it faster (and cheap) to testapplication on differentconfigurations/resolutions/storage
P j t t t
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
26/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Project contents
Project name
P j t t t
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
27/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Project contents
Project name
Src folder with java files
Project contents
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
28/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Project contents
Project name
Src folder with java files Auto-generated files
Project contents
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
29/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Project contents
Project name
Src folder with java files Auto-generated files Android's base files
Project contents
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
30/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Project contents
Project name
Src folder with java files Auto-generated files Android's base files
Compiled files
Project contents
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
31/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Project contents
Project name
Src folder with java files Auto-generated files Android's base files
Compiled files
Resources files
Project contents
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
32/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Project contents
Project name
Src folder with java files Auto-generated files Android's base files
Compiled files
Resources files Android Manifest
How to deploy
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
33/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
How to deploy
Android applications must be signed before they can
be installed on a deviceEclipse can sign applicationsDebug mode, just to test it on your deviceRelease mode, when it's ready for other users
Signing in release mode
-
8/20/2019 MELJUN CORTES ANDROID Lecture Sdk Install
34/34
MELJUN P. CORTES - Programming with Android – SDK install and initial setup
Signing in release mode
Eclipse has a tool called Export Wizard
File > ExportExport Android ApplicationSelect your key and preferences
Application is compiled, signed and aligned, ready to bedeployed
Keep your private key safeUse a strong passwordDon't lend it to anyone
top related