new to android studio

31
NEW TO ANDROID STUDIO 2015/01/24

Upload: -

Post on 15-Jul-2015

501 views

Category:

Technology


1 download

TRANSCRIPT

NEW TO ANDROID STUDIO⼤大⽩白 2015/01/24

OUTLINE

• Introduction

• Android Tools

• Gradle Plugin

INTRODUCTION

ANDROID STUDIO IS …• Google official Android IDE

• Based on IntelliJ IDEA

• Gradle-based build system

• Code templates

• Rich layout editor

GLANCE

TIPS & TRICKS

• Keymap commands

• Plugins

• Help -> Productivity Guide

• More on Tips and Tricks

ANDROID TOOLS

ANDROID DDMS• Log, of course.

• Screen Capture & Record

• System information

MULTI-DEVICES DEBUG

MEMORY MONITOR

MULTI-DEVICES PREVIEW

BUILD VARIANTS

LAYOUT TOOLS ATTRIBUTES

• Support layout design

• Render in tools, not the runtime.

LAYOUT TOOLS ATTRIBUTES• In xml file, add namespace.

• xmlns:tools:“http://schemas.android.com/tools”

• Add to layout editor

• tools:context

• tools:text

• tools:listitem / listheader / listfooter

TOOLS ATTRIBUTES• In xml file, add namespace.

• xmlns:tools:“http://schemas.android.com/tools”

• Add to layout editor

• tools:context

• tools:text

• tools:listitem / listheader / listfooter

TOOLS ATTRIBUTES• In xml file, add namespace.

• xmlns:tools:“http://schemas.android.com/tools”

• Add to layout editor

• tools:context

• tools:text

• tools:listitem / listheader / listfooter

TOOLS ATTRIBUTES• In xml file, add namespace.

• xmlns:tools:“http://schemas.android.com/tools”

• Add to layout editor

• tools:context

• tools:text

• tools:listitem / listheader / listfooter

GRADLE PLUGIN

PROJECT VS MODULE

• Project is …

• A complete android app.

• Contains module(s).

PROJECT VS MODULE

• Module is …

• A component which can build, test or debug independently.

• Three types of modules:

• Java library

• Android library

• Android application

PROJECT STRUCTURES• <project>/

• app/

• src/main/java…

• build.gradle

• library1/

• src/main/java…

• build.gradle

• build.gradle

• settings.gradle

PROJECT STRUCTURES• <project>/

• app/

• src/main/java…

• build.gradle

• library1/

• src/main/java…

• build.gradle

• build.gradle

• settings.gradle

TOP LEVEL SETTINGS.GRADLE

• Tell Gradle which modules to build.

• include ‘:app’

• include ‘:library1’

• project(‘:library1’).projectDir = new File(‘other/place/on/the/computer’)

TOP LEVEL BUILD.GRADLE

• Define common config of all sub-modules.

• buildscript

• allprojects

MODULE BUILD.GRADLE

• One module, one build.gradle file.

• Define android specific, dependencies settings etc.

DEPENDENCIES• Module

• compile project(‘:library1’)

• Local

• compile files(‘libs/gson.jar’)

• compile fileTree(dir :’libs’, include:[‘*.jar’])

• Remote

• compile ‘com.android.support:support-v4:21.0.3’

IMPORT MODULE

IMPORT MODULE

IMPORT MODULE

THAT’S ALL. QUESTION??

THANK YOU!

• Follow me @ http://enginebai.logdown.com