android 專案 建立、編譯 與執行

21
Android 專專專專 專專專專專

Upload: bluma

Post on 06-Jan-2016

85 views

Category:

Documents


0 download

DESCRIPTION

Android 專案 建立、編譯 與執行. 開啟 Android App 專案. [File] → [New] → [Project]. 開啟 Android App 專案. Enter the app name. Enter the SDK for building the project. Minimum Required SDK, setting to API 8 is more general. 開啟 Android App 專案. Configure Launcher Icon. 開啟 Android App 專案. Create Activity. - PowerPoint PPT Presentation

TRANSCRIPT

OpenGL ES

Android Android App[File][New][Project]

Android App

Enter the app name. Enter the SDK for building the projectMinimum Required SDK, setting to API 8 is more generalAndroid AppConfigure Launcher Icon

Android AppCreate Activity

Android AppNew Activity

Android AppInstall Dependencies

Android AppFinish and create an Android App project

Android App

Right ClickAndroid Appsrc/com/example/myfirstandroidapp/MainActivity.javaErrorr cannot be resolved to a variable??R.java Android Android Android App[Project][Build Automatically][Project][Clean]Start a build immediately[Project][Build Project]R.javagengen(R.javagengen)

Android Virtual Device(AVD)Android Virtual Device(AVD)

Android Virtual Device(AVD)

Android Virtual Device(AVD)

The AVDs OS, you can chooseall the level that youve installedfrom Android SDK manager.If you want to run OpenGL ES programs using emulator, you should add a property.Android Virtual Device(AVD)

Choose GPU emulationAndroid Virtual Device(AVD)

Set the Value to yesGPU EmulationAndroid Virtual Device(AVD)The Android Simulator is running now. ( need to wait 3-5 minute for launching )

Android Virtual Device(AVD)After launching, here is your first app.

Real Android PhoneConnect your Android phone with USBPlease ensure that the USB driver is properly installed, or the connection may not be detected.[Run][Run Configurations][Target] Select Always prompt to pick device, and click RunYou can choose a running Android device, and run the program on your Android Phone. MainActivity.javapackage com.example.myfirstandroidapp;

import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.view.MenuItem;import android.support.v4.app.NavUtils;

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; } }package Imported librarys base classmethod MainActivity.java public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

} onCreate: Activity Bundle : savedInstanceState: Activity onCreate (R.layout.activity_main)