Android Development. http://developer.android.com/develop/ 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系



Similar documents
Android Environment SDK

Hello World. by Elliot Khazon

Getting Started with Android Development

Android Setup Phase 2

How to build your first Android Application in Windows

Android Environment SDK

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

The "Eclipse Classic" version is recommended. Otherwise, a Java or RCP version of Eclipse is recommended.

Android Development Tutorial. Nikhil Yadav CSE40816/ Pervasive Health Fall 2011

Installing the Android SDK

Getting Started with Android

Developing In Eclipse, with ADT

Advantages. manage port forwarding, set breakpoints, and view thread and process information directly

Tutorial on Basic Android Setup

Android Development Setup [Revision Date: 02/16/11]

2. Click the download button for your operating system (Windows, Mac, or Linux).

Application Development Setup Guide

ADT Plugin for Eclipse

How to Create an Android Application using Eclipse on Windows 7

Download and Installation Instructions. Android SDK and Android Development Tools (ADT) Microsoft Windows

Arduino & Android. A How to on interfacing these two devices. Bryant Tram

Basic Android Setup Windows Version

Building Your First App

Android 4.4 App Development Essentials

Download and Installation Instructions. Android SDK and Android Development Tools (ADT)

Developing NFC Applications on the Android Platform. The Definitive Resource

Getting Started: Creating a Simple App

Android Application Development: Hands- On. Dr. Jogesh K. Muppala

Android Introduction

How To Develop An Android App On An Android Device

Setting up Sudoku example on Android Studio

Mobile Application Development

Home Course Catalog Schedule Pricing & Savings Training Options Resources About Us

Android Programming. Høgskolen i Telemark Telemark University College. Cuong Nguyen,

App Development for Smart Devices. Lec #2: Android Tools, Building Applications, and Activities

Android Programming: Installation, Setup, and Getting Started

Fahim Uddin 1. Java SDK

Android Development. Marc Mc Loughlin

Introduction to Android Development

l What is Android? l Getting Started l The Emulator l Hello World l ADB l Text to Speech l Other APIs (camera, bitmap, etc)

How To Run A Hello World On Android (Jdk) On A Microsoft Ds.Io (Windows) Or Android Or Android On A Pc Or Android 4 (

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3 SP02

directory to "d:\myproject\android". Hereafter, I shall denote the android installed directory as

Chapter 2 Getting Started

Oracle FLEXCUBE Direct Banking Android Tab Client Installation Guide Release

IOIO for Android Beginners Guide Introduction

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Lab 0 (Setting up your Development Environment) Week 1

With a single download, the ADT Bundle includes everything you need to begin developing apps:

Download and Installation Instructions. Android SDK and Android Development Tools (ADT) Microsoft Windows

System Reference 2013

Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department. Mobile Computing ECOM Eng. Wafaa Audah.

Setting Up Your Android Development Environment. For Mac OS X (10.6.8) v1.0. By GoNorthWest. 3 April 2012

Building graphic-rich and better performing native applications. Pro. Android C++ with the NDK. Onur Cinar

Tutorial: Android Object API Application Development. SAP Mobile Platform 2.3

Tutorial: Android Object API Application Development. Sybase Unwired Platform 2.2 SP02

MMI 2: Mobile Human- Computer Interaction Android

How to Set Up Your PC for Android Application Development

Programming with Android: SDK install and initial setup. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

ID TECH UniMag Android SDK User Manual

Android Basics. Xin Yang

Intel Integrated Native Developer Experience (INDE): IDE Integration for Android*

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

How to Set Up Your PC for Android Application Development

Tutorial #1. Android Application Development Advanced Hello World App

Android Tutorial. Larry Walters OOSE Fall 2011

Android: How To. Thanks. Aman Nijhawan

Epidefender Studio Installation notice

OpenCV on Android Platforms

Board also Supports MicroBridge

How to use the Eclipse IDE for Java Application Development

Advertiser Campaign SDK Your How-to Guide

How To Write A File Station In Android.Com (For Free) On A Microsoft Macbook Or Ipad (For A Limited Time) On An Ubuntu 8.1 (For Ubuntu) On Your Computer Or Ipa (For

About this Release. Introduction. Prerequisites. Installation. Using the Web SDK Packager

Example Connection between USB Host and Android

RTI Connext DDS. Core Libraries Getting Started Guide Addendum for Android Systems Version 5.2.0

Introduction: The Xcode templates are not available in Cordova or above, so we'll use the previous version, for this recipe.

Android Development Tools for Eclipse

CSA Software Listing Table of Contents. Both Windows and Mac platforms are supported.

SIM900 Eclipse environment install Application Note_V1.00

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Titanium Mobile: How-To

Developing for MSI Android Devices

Introduction to Android Programming (CS5248 Fall 2015)

How to Install Applications (APK Files) on Your Android Phone

Login with Amazon Getting Started Guide for Android. Version 2.0

How to develop your own app

Now that we have the Android SDK, Eclipse and Phones all ready to go we can jump into actual Android development.

ANDROID APP DEVELOPMENT: AN INTRODUCTION CSCI /19/14 HANNAH MILLER

Running a Program on an AVD

Android: Setup Hello, World: Android Edition. due by noon ET on Wed 2/22. Ingredients.

Getting Started With Android

1) SETUP ANDROID STUDIO

UP L18 Enhanced MDM and Updated Protection Hands-On Lab

Jordan Jozwiak November 13, 2011

Introduction to Gear VR Development in Unity APPENDIX A: SETUP (WINDOWS 7/8)

POOSL IDE Installation Manual

Developing Android Apps: Part 1

Transcription:

Android Development http://developer.android.com/develop/ 吳 俊 興 國 立 高 雄 大 學 資 訊 工 程 學 系

Android 3D 1. Design 2. Develop Training API Guides Reference 3. Distribute 2

Development Training Get Started Building Your First App Managing the Activity Lifecycle Building a Dynamic UI with Fragments Saving Data Interacting with Other Apps Advanced Training 3

Development - Get Started Learn how to set up the development environment Java SDK, Android SDK, Eclipse, ADT Plugin for Eclipse Learn how to build the first Android app How to create an Android project How to run a debuggable version of the app Learn some fundamentals of Android app design 4

Installing the SDK Set up the Android development environment 1. Download the Android SDK Check and install Java SDK if necessary Download the latest SDK tools and platforms using the SDK Manager 2. Install Eclipse 3. Install ADT (Android Developtment Tools) plugin for Eclipse Tip: For easy access to the SDK tools from a command line, add the location of the SDK's tools/ and platform-tools to your PATH environment variable http://developer.android.com/sdk/installing/ 5

Step 1. Download the Android SDK http://developer.android.com/sdk/ Includes only the core SDK tools (mainly Android SDK Manager) to download the rest of the SDK packages (such as the latest system image) Checks for required tools, such as the proper Java SE Development Kit (JDK) and installs it if necessary To develop an Android app, you also need to download at least one Android platform and the latest SDK Platform-tools For the first time, simply click Install to install the recommended packages Anytime you can launch the Android SDK Manager to download others 6

Adding Platforms and Packages SDK Tools (Required) The new SDK installation already has the latest version Make sure to keep this up to date SDK Platform-tools (Required) Must install this package for the first time SDK Platform (Required) Must download at least one platform to compile applications The latest platform version is recommended To get started, download the latest Android version, plus the lowest version planned to support (we recommend Android 2.2 for your lowest version) System Image (Recommended) It's a good practice to download system images for all versions of Android your app supports and test your app running on them with the Android emulator Android Support (Recommended) Includes a static library to use some of the latest Android APIs on devices running a platform version as old as Android 1.6 SDK Samples (Recommended) Include source codes used to learn about Android, load as a project and run, or reuse in your own app 7

Step 2. Install Eclipse 1. Download Eclipse from http://www.eclipse.org/downloads/ Classic Version recommended, otherwise Java or RCP Version Self-contained executable file (zip) 2. Unzip it to your preferred location, i.e., \Program Files\Eclipse 3. Create a shortcut as you like. Start installation as the first time of running Eclipse Select a default workspace (folder) to store projects 8

Step 3. Install the ADT plugin for Eclipse Step 3-1. Download the ADT Plugin 1. Start Eclipse, then select Help->Install New Software 2. Click Add, in the top-right corner In the Add Repository dialog that appears, enter Name: ADT Plugin Location: https://dl-ssl.google.com/android/eclipse/ If having trouble acquiring the plugin, try using "http" instead of "https" 3. In the Available Software dialog, select the checkbox next to Developer Tools and click Next In the next window, you'll see a list of the tools to be downloaded. Click Next Read and accept the license agreements, then click Finish If you get a security warning saying that the authenticity or validity of the software can't be established, click OK 4. When installation completes, restart Eclipse 9

Step 3. Install the ADT plugin for Eclipse (Cont.) Step 3-2. Configure the ADT Plugin Once restart, check the location of Android SDK directory Select Window -> Preferences -> Android -> SDK Location If succeeding, Select Window -> Show Toolbar to enable ADT toolbar To update the ADT Plugin, select Help -> Check for Updates 10

Building the First App Creating an Android Project Create a Project with Eclipse Create a Project with Command Line Tools Running Your Application Run on a Real Device Run on the Emulator Building a Simple User Interface Starting Another Activity The default project includes a default set of "Hello World" source files that allow you to immediately run the app 11

Create a Project with Eclipse 1. Click New Android App Project in the toolbar or New -> Select a Wizard -> Android -> Android Application Project 2. Fill in the form Application Name: My First App Project Name: MyFirstApp Package Name: userid.example.myfirstapp Unique namespace across all packages installed on the Android system Build SDK: default set to the latest version Minimum Required SDK: the lowest version for support your app 12

Create a Project with Eclipse (Cont.) 3. Configure the launcher icon May use the default to generate an icon for all screen densities Before publishing app, be sure the icon meets the specifications defined in the Iconography design guide 4. Select an activity template from which to begin building your app For this project, select BlankActivity Leave all the details for the activity in their default state and click Finish It may ask to install dependencies (Android Support Library) 13

My First App Created 14

File List of <Workspace>\My First App.classpath.project AndroidManifest.xml bin/androidmanifest.xml bin/jarlist.cache bin/classes/wuch/example/my/first/app/ BuildConfig.class MainActivity.class R$attr.class R$drawable.class R$id.class R$layout.class R$menu.class R$string.class R$style.class R.class gen/wuch/example/my/first/app/ BuildConfig.java R.java ic_launcher-web.png libs/android-support-v4.jar Describes the fundamental characteristics and defines each of its components proguard-project.txt project.properties For app resources res/drawable-hdpi/ic_action_search.png res/drawable-hdpi/ic_launcher.png res/drawable-ldpi/ic_launcher.png res/drawable-mdpi/ic_action_search.png res/drawable-mdpi/ic_launcher.png res/drawable-xhdpi/ic_action_search.png res/drawable-xhdpi/ic_launcher.png res/layout/activity_main.xml res/menu/activity_main.xml res/values/strings.xml res/values/styles.xml res/values-v11/styles.xml res/values-v14/styles.xml defining UI Default Activity class loads a layout file that says "Hello World" src/wuch/example/my/first/app/mainactivity.java For app's main source files 15

src\com\wuch\my\first\app/mainactivity.java package com.wuch.my.first.app; import android.os.bundle; import android.app.activity; import android.view.menu; public class MainActivity extends Activity { @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } } @Override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.activity_main, menu); return true; } 16

res\values\strings.xml <resources> <string name="app_name">my First App</string> <string name="hello_world">hello world!</string> <string name="menu_settings">settings</string> <string name="title_activity_main">mainactivity</string> </resources> 17

Create a Project with Command Line Tools 1. Make sure to add Android SDK paths set PATH= U:\Data\Android\android-sdk\platformtools\; U:\Data\Android\androidsdk\tools 2. Change directories into the Android SDK s tools/ path U: cd \Data\Android\android-sdk\tools 3. Execute to check settings android list targets 4. Create projects 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 targets Replace <path-to-workspace> with the location to save the Android projects 18

Running the App - Run on a Real Device 1. Plug in your device 2. Ensure that USB debugging is enabled in the device Settings -> Applications -> Development 3a. Run the app from Eclipse Open the project's file and click Run from the toolbar Eclipse installs the app on the connected device and starts it 3b. Run the app from a command line 1.Make sure the Android SDK platform-tools/ directory is included in PATH 2.Change directories to the root of the Android project and execute: ant debug 3.Execute: adb install bin/myfirstapp-debug.apk 4.On the device, locate MyFirstActivity and open it 19

Running the App - Run on the Emulator Firstly create an Android Virtual Device (AVD) 1. Launch the Android Virtual Device Manager: In Eclipse, click AVD Manager from the toolbar From the command line, change directories to <sdk>/tools/ and execute: android avd 2. In the AVD Manager panel, click New 3. Fill in the details for the AVD Name: My_Phone Platform target: Android 4.1.2 SD card size: 512 MiB Snapshot: Enabled Skin: (HVGA is default) 4. Click Create AVD 5. Select the new AVD and click Start 6. After the emulator boots up, unlock the emulator screen 7. Open the project's files and click Run from the toolbar. Eclipse installs the app and starts it Run the app from the command line 1.Change directories to the root of the Android project and execute: ant debug 2.execute:adb install bin/myfirstapp-debug.apk 3.On the emulator, locate MyFirstActivity 20

Default Location of AVD files Android tool always creates an <AVD_name>.ini file for the AVD at the root of the.android/avd/ directory ~/.android/avd/ (on Linux/Mac) C:\Documents and Settings\<user>\.android\ on Windows XP, and C:\Users\<user>\.android\ on Windows 7 and Vista Choice: move.android from your directory to the default ~/.android/avd/ http://developer.android.com/tools/devices/managing-avdscmdline.html#defaultlocation You may need to copy your AVD to.android/avd 21

Exercise Exercise: Change message to Hello world! Cool NUKCSIE! 22

Installation Case Android SDK (2.2 + 4.2): 2.46GB Eclipse: 299MB AVD (512MB SD): 518MB My First App: 1.02MB 23