Gradle + Google I/O 2014 remarks

Post on 23-Aug-2014

338 views 2 download

Tags:

description

 

Transcript of Gradle + Google I/O 2014 remarks

Do you speak Gradle?

+Damian Mee@meeDamian

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)

CHEERFUL OFFTOPDevelopers in Belarus

can now publishPAID APPS

to Play Store

:-)

Variants

● Build Type (debug or release)

● Product Flavor (paid, free, whitelabel)

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

COMING SOON

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

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

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

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

|-- settings.gradle

include ‘:app’

include ‘:app’, ‘:FloatingLabel’

|-- settings.gradle (with library projects)

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

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

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

|-- 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

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

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

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

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' }

// ...

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' }

// ...

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' }

// ...

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

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

// ...

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

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

// ...

Shameless auto-promotion

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

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

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

// ...

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

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

// ...

// ... 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

// ...

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")}

// ...

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")}

// ...

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

// ...

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")}

// ...

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")}

Android Gradle plugin docs SUCK ;-(

But community rocks ;)

+Android Developer Toolsgoo.gl/6a0aKP

+Tor Norbye

+Alex Ruiz[gradle]

Fin and Q&Aor

...

Fin and Q&Aor

Material DesignA little bit about

and Tools

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)

Leave teleportation for Star Trek

Keep things delightful

Structure information

Loads of beautifully crafted icons

Depth helps with comprehension

Interaction emits energy

google.com/design

Kick start

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

values-v21/styles.xml

defaultConfig { targetSdkVersion 'L'}

app/build.gradle

Remarks

● CardView and RecyclerView

● android:colorPrimary, android:colorAccent

● android:tintMode=””

Android Studio 0.8.1Is now in Beta

New project structure view (soon)

API levels in wizard

Layout Editor (menu)

Layout Editor (different versions)

Typechecking to the resource system

Non-retarded emulators!

genymotion.com

Other, usual & gradual improvements

● Wear, TV & Glass now in wizard

● RTL layouts improvements

● Eclipse migrate process

● etc...

+Damian Mee@meeDamian

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