0% found this document useful (0 votes)
9 views18 pages

FU Lecture 03

This document provides a step-by-step guide for creating your first Android application using Eclipse. It covers how to set up a new Android project, run the application in an emulator, and execute the app from the command line. Additionally, it includes instructions for creating a project using command-line tools.

Uploaded by

Chị Anh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views18 pages

FU Lecture 03

This document provides a step-by-step guide for creating your first Android application using Eclipse. It covers how to set up a new Android project, run the application in an emulator, and execute the app from the command line. Additionally, it includes instructions for creating a project using command-line tools.

Uploaded by

Chị Anh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Creating Your First

Android Application

Hello World!
Today's Agenda
 Create an Android Project in Eclipse

 Run the Android Application

 Run your app from the command line


Create an Android Project in Eclipse
 Click New in the toolbar or File → New → Android Application Project.
 Fill in the form that appears:
 Application Name
 Project Name
 Package Name
 Minimum Required SDK
 Target SDK
 Compile With
 Theme
 Click Next.
 Leave the default selections and click Next
 Select BlankActivity and click Next.
 Click Finish.
Create an Android Project in Eclipse
Create an Android Project in Eclipse
Create an Android Project in Eclipse
Create an Android Project in Eclipse
Create an Android Project in Eclipse
MainActivity.java
activity_main.xml
strings.xml
AndroidManifest.xml
R.java
Run the Android Application
 Run → Run (or click the “Run” button)

 Select “Android Application”

 The emulator may take a few minutes to start, so be patient!

 You don't need to restart the emulator when you have a new
version of your application
Run the Android Application
Run the Android Application
Run your app from the command line
 Change directories to the root of your Android project and
execute:
ant debug
 Make sure the Android SDK platform-tools/ directory is
included in your PATH environment variable, then execute:
adb install bin/HelloWorld-debug.apk
 On the emulator, locate HelloWorld and open it.
Create a Project with CMD Tools
 Run CMD tool
 Change directories into the Android SDK’s tools/ path.
 Execute:
android list targets
 Execute:
android create project --target <target-id> --name MyFirstApp \
--path <path-to-workspace>/MyFirstApp
--activity MainActivity \ --package com.example.myfirstapp

 Replace <target-id> with an id from the list of targets


 Replace <path-to-workspace> with the location in which you want to save

You might also like