Getting Started with Android Studio Presentation.pdf - Google Drive

3 downloads 14 Views 2MB Size Report
There was a problem loading more pages. Retrying... Getting Started with Android Studio Presentation.pdf. Getting Starte
Getting Started with Android Studio

Outline:

1. Getting started 2. Familiarizing with the Android Studio workspace and utilities 3. What's missing still? 4. Q&A

Getting Started What's Android Studio? Ans: Android IDE on steroids. Features: - Gradle build + everything in ADT (almost) - Better extensibility in intelliJ means we'll get better tooling in the future Download here -> http://developer.android. com/sdk/installing/studio.html

Getting Started

1. Creating a new Android project 2. Importing an existing Android project 3. build.gradle basics 4. Project Facets

Creating a project from scratch

Will take some time to build...

Manual rebuilds: Build -> Rebuild Project

CTRL+R to run in an emulator (later: edit run configurations)

Importing An Existing Project From Eclipse

Done!

New Project Structure HelloWorld /build/ /libs/ /src/main/java/... /src/main/res/... src/main/AndroidManifest. xml build.gradle THEREFORE...

Eclipse generates custom build. gradle for you sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aild.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } }

build.gradle basics - it defines your project ● dependencies (jars, library projects) & scopes (compile, runtime, test, classpath) ● directory structure (source, res, target, etc.) ● Android SDK version (min, target, compile) About the new Android Gradle build -> http: //goo.gl/ZD2fr

Repositories - Uses Maven repos (yay!) - able to specify 3rd party repo repositories { // standard mavenCentral() // 3rd party repo maven { url 'http://google-api-client-libraries.appspot. com/mavenrepo' }

Dependencies (jars) dependencies { compile files('libs/android-support-v4.jar') compile files('libs/jackson-core-2.1.3.jar') } There's a shorthand to include all jars in libs/ (please Google for it)

Android SDK dependencies dependencies { ... compile 'com.google.android.gms:playservices:3.1.36' } Needs: gradle plugin 0.4.2, Google Play Services installed via SDK. Read more here -> http://goo.gl/GF0V8

3rd Party Library Projects - library project must build using Gradle too - settings.gradle must define the project; include ':my_thirdparty_lib_project' dependencies { ... //other deps compile project(':my_thirdparty_lib_project) }

apply-plugin - defines if the project is a regular project or a library project - e.g. ● apply plugin: 'android', OR ● apply plugin: 'android-library'

Android SDK android { compileSdkVersion 17 buildToolsVersion "17.0.0" defaultConfig { minSdkVersion 11 targetSdkVersion 16 } }

Gradle Build Multi-project & dependency (Android-specific): http://goo.gl/EeCLB Gradle Dependency Management: http://goo. gl/IE0T6

Project Facets 2 types: - IntelliJ + Android plugin facet: Android ● project settings: IntelliJ-specific ● how? import sources - Android Studio: Android-Gradle ● project settings: build.gradle ● Google-endorsed, Android build ● how? import as Gradle project or create new

Project Facets - right click Project -> Open Module Settings

Project Facets

Familiarize with the Android Studio Workspace and UI

Familiarize with the Android Studio Graphical Layout Editor

Familiarize with the Android Studio Graphical Layout Editor - continued

Android Specific Toolbar

1. Run configuration selection 2. Run 3. Debug 4. Attach Debugger 5. IDE settings (not Android Specific) 6. Project Structure (not Android Specific) 7. Synchronize project with Gradle file 8. Android Virtual Device (AVD) Manager 9. SDK Manager 10. Monitor

Editing Run/Debug Configuration

Run/Debug Configuration Dialog

Familiarize with the Android Studio Running on Emulator/Device AVD Manager

Familiarize with the Android Studio Running on Emulator/Device How To Launch The Emulator : Shift + F10 in Windows and Linux or Ctrl + R in OSX

DDMS

Integrated 9patch Drawable Tool Double-click on 9patch files to trigger

What's missing in Android Studio - some project generation wizards - not all UI widgets are present - custom/3rd party UI widgets - A UI for configuring Gradle build settings - UI for creating Android sample projects

Tips and Tricks -Rename refactoring tool, but better. -Code folding -Soft wrapping in editor -Git integration i. easy one file per commit, ii. Ctrl + D command to look at difference of unstaged changes with the commit on the master branch)

Tips and Tricks TODOs and FIXMEs

Tips and Tricks Code Completion

Keyboard Shortcuts Table Eclipse vs IntelliJ Keyboard Shortcuts

Eclipse

Android Studio/IntelliJ

Go to method

Ctrl+O

Ctrl+F12

Content Assist

Ctrl+Space

Ctrl+Space

Open Call Hierarchy

Ctrl+Alt+H

Ctrl+H

Run Android App

Ctrl+F11

Shift+F10

Go to implementation

F3

Ctrl+B

Reformat Code

Ctrl+Shift+F

Ctrl+Alt+L

Rename refactoring

Shift+Alt+R

Shift+F6

Find Usages Optimize Imports

Alt+F7 Ctrl+Shift+O

Ctrl-Alt-O

More IntelliJ Keyboard Shortcuts Just press Ctrl+Shift+A and key in the keyboard shortcuts name to find out more Start being a pro when you know your own tools and be like him...

Questions?

Suggest Documents