前言
本章會介紹如何建立基本Android應用,我們開發主要Android Strudio做為開發工具,選擇Gradle為建構
工具主要的原因,是因為它已經是官方的開發工具,你只需要寫幾行建構方式,就可以給不同平台去使用。
事前準備
下載Android Strudio: http://developer.android.com/sdk/index.html
建立Android APP專案
File –> New –> New Project…

選擇目的裝置的類型: 選擇平板和手機

選擇空白活動

預設活動名稱和版面名稱不變

專案家目錄可以看到build.gradle和settings.gradle,

Gradle Scripts檔案 | 說明 |
build.gradle | |
local.properties | sdk.dir=<Location of Android sdk>
|
settings.gralde | |
在android專案會有兩個build.gradle的檔案,一個是/app/build.gradle和/root/build.gradle,
(1) root/app/build.gradle
apply plugin: 'com.android.application'
android { compileSdkVersion 23 buildToolsVersion "23.0.1"
defaultConfig { applicationId "tw.com.bryan.myapplication" minSdkVersion 8 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' }
|
留言
張貼留言