Gradle + Google I/O 2014 remarks

53
Do you speak Gradle? +Damian Mee @meeDamian

description

 

Transcript of Gradle + Google I/O 2014 remarks

Page 1: Gradle + Google I/O 2014 remarks

Do you speak Gradle?

+Damian Mee@meeDamian

Page 2: Gradle + Google I/O 2014 remarks

So, what’s gradle?

● It’s a build system● Based on Groovy● Extensible (plugins!)

● Introduced to Android with Android Studio● No support for NDK (yet)

Page 3: Gradle + Google I/O 2014 remarks

CHEERFUL OFFTOPDevelopers in Belarus

can now publishPAID APPS

to Play Store

:-)

Page 4: Gradle + Google I/O 2014 remarks

Variants

● Build Type (debug or release)

● Product Flavor (paid, free, whitelabel)

● Multi-APK Splits (ARM, x86, MIPS)

COMING SOON

Page 5: Gradle + Google I/O 2014 remarks

Enough bla bla blaProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | |-- otherFlavor| |-- build.gradle|-- build.gradle|-- gradle.properties|-- settings.gradle

Page 6: Gradle + Google I/O 2014 remarks

ProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | || | +-- otherFlavor| || |-- build.gradle||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 7: Gradle + Google I/O 2014 remarks

ProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | || | +-- otherFlavor| || |-- build.gradle||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 8: Gradle + Google I/O 2014 remarks

ProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | || | +-- otherFlavor| || |-- build.gradle||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 9: Gradle + Google I/O 2014 remarks

|-- settings.gradle

include ‘:app’

Page 10: Gradle + Google I/O 2014 remarks

include ‘:app’, ‘:FloatingLabel’

|-- settings.gradle (with library projects)

ProjectHome+-- app+-- FloatingLabel||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 11: Gradle + Google I/O 2014 remarks

ProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | || | +-- otherFlavor| || |-- build.gradle||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 12: Gradle + Google I/O 2014 remarks

ProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | || | +-- otherFlavor| || |-- build.gradle||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 13: Gradle + Google I/O 2014 remarks

|-- gradle.properties

STORE_FILE=/home/mee/dev/android/keys/datKeySTORE_PASSWORD=superSecretPasswordKEY_ALIAS=projecthomeKEY_PASSWORD=unbreakabalePasswordOUTPUT_DIR=/home/mee/dev/android/binaries/ProjectHomePARSE_KEY_PUBLISHER=NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN

Page 14: Gradle + Google I/O 2014 remarks

ProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | || | +-- otherFlavor| || |-- build.gradle||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 15: Gradle + Google I/O 2014 remarks

ProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | || | +-- otherFlavor| || |-- build.gradle||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 16: Gradle + Google I/O 2014 remarks

ProjectHome|-- app| |-- src| | |-- main| | | +-- java| | | +-- res| | | |-- AndroidManifest.xml| | || | +-- otherFlavor| || |-- build.gradle||-- build.gradle|-- gradle.properties|-- settings.gradle

Page 17: Gradle + Google I/O 2014 remarks

apply plugin: 'com.android.application'

android { compileSdkVersion 'android-L' buildToolsVersion "20.0"

defaultConfig { applicationId 'pl.d30.goodnotes' minSdkVersion 15 targetSdkVersion 'L' versionCode 1 versionName '1.0' }

// ...

Page 18: Gradle + Google I/O 2014 remarks

apply plugin: 'com.android.application'

android { compileSdkVersion 'android-L' buildToolsVersion "20.0"

defaultConfig { applicationId 'pl.d30.goodnotes' minSdkVersion 15 targetSdkVersion 'L' versionCode 1 versionName '1.0' }

// ...

Page 19: Gradle + Google I/O 2014 remarks

apply plugin: 'com.android.application'

android { compileSdkVersion 'android-L' buildToolsVersion "20.0"

defaultConfig { applicationId 'com.meedamian.projecthome' minSdkVersion 15 targetSdkVersion 'L' versionCode 1 versionName '1.0' }

// ...

Page 20: Gradle + Google I/O 2014 remarks

// ... buildTypes { release { // here’s where signing code would go } }

productFlavors { otherFlavor { // flavor-specific configuration, ex: buildConfigField "String", "PARSE_KEY", PARSE_KEY_PUBLISHER } }}

// ...

Page 21: Gradle + Google I/O 2014 remarks

// ... buildTypes { release { // here’s where signing code would go } }

productFlavors { otherFlavor { // flavor-specific configuration, ex: buildConfigField "String", "PARSE_KEY", PARSE_KEY_PUBLISHER } }}

// ...

Page 22: Gradle + Google I/O 2014 remarks

Shameless auto-promotion

meeDamian.com/post/publishing-with-gradlegoo.gl/zmlS10

Page 23: Gradle + Google I/O 2014 remarks

// ... buildTypes { release { // here’s where signing code would go } }

productFlavors { otherFlavor { // flavor-specific configuration, ex: buildConfigField "String", "PARSE_KEY", PARSE_KEY_PUBLISHER } }}

// ...

Page 24: Gradle + Google I/O 2014 remarks

// ... buildTypes { release { // here’s where signing code would go } }

productFlavors { otherFlavor { // flavor-specific configuration, ex: buildConfigField "String", "PARSE_KEY", PARSE_KEY_PUBLISHER } }}

// ...

Page 25: Gradle + Google I/O 2014 remarks

// ... buildTypes { release { // here’s where signing code would go } }

productFlavors { otherFlavor { // flavor-specific configuration, ex: buildConfigField "String", "PARSE_KEY", PARSE_KEY_PUBLISHER } }}

// ...

BuildConfig.PARSE_KEY

Page 26: Gradle + Google I/O 2014 remarks

// ...

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:17.0.0' compile project(":FloatingLabel") compile files("libs/libraryName.jar")}

Page 27: Gradle + Google I/O 2014 remarks

// ...

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:17.0.0' compile project(":FloatingLabel") compile files("libs/libraryName.jar")}

Page 28: Gradle + Google I/O 2014 remarks

// ...

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:17.0.0' compile project(":FloatingLabel") compile files("libs/libraryName.jar")}

gradleplease.appspot.com

Page 29: Gradle + Google I/O 2014 remarks

// ...

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:17.0.0' compile project(":FloatingLabel") compile files("libs/libraryName.jar")}

Page 30: Gradle + Google I/O 2014 remarks

// ...

dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:17.0.0' compile project(":FloatingLabel") compile files("libs/libraryName.jar")}

Page 31: Gradle + Google I/O 2014 remarks

Android Gradle plugin docs SUCK ;-(

But community rocks ;)

+Android Developer Toolsgoo.gl/6a0aKP

+Tor Norbye

+Alex Ruiz[gradle]

Page 32: Gradle + Google I/O 2014 remarks

Fin and Q&Aor

...

Page 33: Gradle + Google I/O 2014 remarks

Fin and Q&Aor

Material DesignA little bit about

and Tools

Page 35: Gradle + Google I/O 2014 remarks

Material Design

● “paper” and “ink” based design language

● introduced with Android L-something

● cross-everything (mobile, desktop, wear, etc)

● adds depth through shadows

● beautifully crafted (unlike this ugly presentation)

Page 36: Gradle + Google I/O 2014 remarks

Leave teleportation for Star Trek

Page 37: Gradle + Google I/O 2014 remarks

Keep things delightful

Page 38: Gradle + Google I/O 2014 remarks

Structure information

Page 39: Gradle + Google I/O 2014 remarks

Loads of beautifully crafted icons

Page 40: Gradle + Google I/O 2014 remarks

Depth helps with comprehension

Page 41: Gradle + Google I/O 2014 remarks

Interaction emits energy

Page 42: Gradle + Google I/O 2014 remarks

google.com/design

Page 43: Gradle + Google I/O 2014 remarks

Kick start

<style name="Theme.Awesome" parent="@android:style/Theme.Material.Light.DarkActionBar"></style>

values-v21/styles.xml

defaultConfig { targetSdkVersion 'L'}

app/build.gradle

Page 44: Gradle + Google I/O 2014 remarks

Remarks

● CardView and RecyclerView

● android:colorPrimary, android:colorAccent

● android:tintMode=””

Page 45: Gradle + Google I/O 2014 remarks

Android Studio 0.8.1Is now in Beta

Page 46: Gradle + Google I/O 2014 remarks

New project structure view (soon)

Page 47: Gradle + Google I/O 2014 remarks

API levels in wizard

Page 48: Gradle + Google I/O 2014 remarks

Layout Editor (menu)

Page 49: Gradle + Google I/O 2014 remarks

Layout Editor (different versions)

Page 50: Gradle + Google I/O 2014 remarks

Typechecking to the resource system

Page 51: Gradle + Google I/O 2014 remarks

Non-retarded emulators!

genymotion.com

Page 52: Gradle + Google I/O 2014 remarks

Other, usual & gradual improvements

● Wear, TV & Glass now in wizard

● RTL layouts improvements

● Eclipse migrate process

● etc...

Page 53: Gradle + Google I/O 2014 remarks

+Damian Mee@meeDamian

meeDamian.com/post/publishing-with-gradlegoo.gl/zmlS10