SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Gradle not just an ANT
replacement
Goals of Gradle (from official docs)
● Make it easy reuse code and resources (.aar)
● Make it easy to create several variants of an application
● Make it easy to configure, extend and customize the
build process
● Good IDE integration
About Gradle
●

Is based on groovy:
○ binary-compatible with java
○ Most java code is syntactically valid on Groovy
○ The gradle installation comes with groovy

●

You better use a gradle wrapper for your
android projects
Android Studio
● If something goes wrong, use gradle on the command
line
● use this button:
● One update can “break” your project
● If something goes wrong, use gradle on the command
line
Basic gradle config
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.0+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
}
Adding libs
dependencies {
//

MavenCentral deps
compile 'com.android.support:support-v4:19.0.0'
compile 'com.android.support:appcompat-v7:19.0.0'
compile 'com.squareup.retrofit:retrofit:1.2.2'
compile 'com.squareup.okhttp:okhttp:1.2.1'

//

project dep:
compile project(“:libraries:lib1”)

//

jar dep:
compile files(‘libs/a.jar”, “libs/b.jar”)
compile fileTree(dir: “libs”, include: “*.jar”)

}
Basic gradle commands
$ gradle tasks
$ gradle tasks --all
$ gradle assembleDebug
$ gradle assembleRelease
$ gradle clean
$ gradle installDebug
$ gradle uninstallAll
Gradle build customization
android {
compileSdkVersion 19
defaultConfig {
versionCode 1
versionName "1.0"
minSdkVersion 16
targetSdkVersion 16
}
}
Build Types
buildTypes {
debug {
packageNameSuffix ".debug"
}
release {
runProguard true
proguardFile getDefaultProguardFile('proguard-androidoptimize.txt')
}
}

$ gradle installFreeDebug
Build Variants
productFlavors {
free {
packageName "com.bitcoinlab.android.free"
buildConfig “public static final boolean FULL_VERSION =
false;”
}
full {
packageName "com.bitcoinlab.android.full"
versionName "2.0"
versionCode 20
buildConfig “public static final boolean FULL_VERSION =
true;”
signingConfig signingConfigs.myConfig
}
}
Build Variants specific files & deps
src/full/java/src/”packagename”/file.java
src/full/res/values/strings.xml
src/full/AndroidManifest.xml

dependencies {
fullCompile ‘com.squareup.okhttp:okhttp:1.2.1'
}
A source file can’t exists on main src folder and at
the same time on a flavour src folder: put a class into
main, or in every buildType but not both.
BuildConfig
import java.text.SimpleDateFormat
def buildTime() {
def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
df.setTimeZone(TimeZone.getTimeZone("UTC"))
return df.format(new Date())
}
defaultConfig {
buildConfig """
public static final String GIT_SHA = "${gitSha()}";
public static final String BUILD_TIME = "${buildTime()}";
"""
}
Android Studio Integration
Some things you can do with gradle
●

free/paid apk

●

debug/release version

●

beta/alpha/”any git branch” apk

●

Use multiple flavors + multiple-apk play store support to distribute
smaller apks (depending on screen size or android version)

●

build your customized integration and test server in minutes
Oriol Jiménez
@oriolj
oriolj@gmail.com

Mais conteúdo relacionado

Mais procurados

Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for androidzhang ghui
 
Gradle build automation tool
Gradle   build automation toolGradle   build automation tool
Gradle build automation toolIoan Eugen Stan
 
Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Corneil du Plessis
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developersTricode (part of Dept)
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradleLiviu Tudor
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...ZeroTurnaround
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondKaushal Dhruw
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another buildIgor Khotin
 
Gradle enabled android project
Gradle enabled android projectGradle enabled android project
Gradle enabled android projectShaka Huang
 
Making the Most of Your Gradle Builds
Making the Most of Your Gradle BuildsMaking the Most of Your Gradle Builds
Making the Most of Your Gradle BuildsEgor Andreevich
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Rajmahendra Hegde
 

Mais procurados (19)

Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 
Introduction to gradle
Introduction to gradleIntroduction to gradle
Introduction to gradle
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for android
 
Gradle
GradleGradle
Gradle
 
Gradle build automation tool
Gradle   build automation toolGradle   build automation tool
Gradle build automation tool
 
Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!Gradle: The Build System you have been waiting for!
Gradle: The Build System you have been waiting for!
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developers
 
Managing dependencies with gradle
Managing dependencies with gradleManaging dependencies with gradle
Managing dependencies with gradle
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
[Image Results] Java Build Tools: Part 2 - A Decision Maker's Guide Compariso...
 
Gradle
GradleGradle
Gradle
 
Gradle build capabilities
Gradle build capabilities Gradle build capabilities
Gradle build capabilities
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & Beyond
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another build
 
Gradle enabled android project
Gradle enabled android projectGradle enabled android project
Gradle enabled android project
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Making the Most of Your Gradle Builds
Making the Most of Your Gradle BuildsMaking the Most of Your Gradle Builds
Making the Most of Your Gradle Builds
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 

Destaque

Android Gradle about using flavor
Android Gradle about using flavorAndroid Gradle about using flavor
Android Gradle about using flavorTed Liang
 
From Ant to Maven to Gradle a tale of CI tools for JVM
From Ant to Maven to Gradle a tale of CI tools for JVMFrom Ant to Maven to Gradle a tale of CI tools for JVM
From Ant to Maven to Gradle a tale of CI tools for JVMBucharest Java User Group
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Andres Almiray
 
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android StudioMichael Pan
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating systemSalma Begum
 

Destaque (11)

Android Gradle about using flavor
Android Gradle about using flavorAndroid Gradle about using flavor
Android Gradle about using flavor
 
Gradle
GradleGradle
Gradle
 
From Ant to Maven to Gradle a tale of CI tools for JVM
From Ant to Maven to Gradle a tale of CI tools for JVMFrom Ant to Maven to Gradle a tale of CI tools for JVM
From Ant to Maven to Gradle a tale of CI tools for JVM
 
Why gradle
Why gradle Why gradle
Why gradle
 
Android studio
Android studioAndroid studio
Android studio
 
Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster Javaone - Gradle: Harder, Better, Stronger, Faster
Javaone - Gradle: Harder, Better, Stronger, Faster
 
Introduction to Android Studio
Introduction to Android StudioIntroduction to Android Studio
Introduction to Android Studio
 
Android studio 2.0
Android studio 2.0Android studio 2.0
Android studio 2.0
 
Android studio
Android studioAndroid studio
Android studio
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating system
 
Android ppt
Android ppt Android ppt
Android ppt
 

Semelhante a Gradle presentation

[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the androidJun Liu
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginXavier Hallade
 
Intro to Gradle + How to get up to speed
Intro to Gradle + How to get up to speedIntro to Gradle + How to get up to speed
Intro to Gradle + How to get up to speedReid Baker
 
Level Up Your Android Build -Droidcon Berlin 2015
Level Up Your Android Build -Droidcon Berlin 2015Level Up Your Android Build -Droidcon Berlin 2015
Level Up Your Android Build -Droidcon Berlin 2015Friedger Müffke
 
Getting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle pluginGetting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle plugintobiaspreuss
 
Moderne Android Builds mit Gradle
Moderne Android Builds mit GradleModerne Android Builds mit Gradle
Moderne Android Builds mit Gradleinovex GmbH
 
Hacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfHacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfShaiAlmog1
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfigVijay Shukla
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...Dicoding
 
Config/BuildConfig
Config/BuildConfigConfig/BuildConfig
Config/BuildConfigVijay Shukla
 
It's always your fault. Poznań ADG 2016
It's always your fault. Poznań ADG 2016It's always your fault. Poznań ADG 2016
It's always your fault. Poznań ADG 2016Przemek Jakubczyk
 
Разработка приложений в Android studio
Разработка приложений в Android studioРазработка приложений в Android studio
Разработка приложений в Android studioDev2Dev
 
Android gradle-build-system-overview
Android gradle-build-system-overviewAndroid gradle-build-system-overview
Android gradle-build-system-overviewKevin He
 
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018Somkiat Khitwongwattana
 
Modularisation avec Gradle et Dagger
Modularisation avec Gradle et DaggerModularisation avec Gradle et Dagger
Modularisation avec Gradle et DaggerMartin Devillers
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDKKirill Kounik
 

Semelhante a Gradle presentation (20)

[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android[DEPRECATED]Gradle the android
[DEPRECATED]Gradle the android
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
 
Intro to Gradle + How to get up to speed
Intro to Gradle + How to get up to speedIntro to Gradle + How to get up to speed
Intro to Gradle + How to get up to speed
 
Level Up Your Android Build -Droidcon Berlin 2015
Level Up Your Android Build -Droidcon Berlin 2015Level Up Your Android Build -Droidcon Berlin 2015
Level Up Your Android Build -Droidcon Berlin 2015
 
Getting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle pluginGetting started with building your own standalone Gradle plugin
Getting started with building your own standalone Gradle plugin
 
Moderne Android Builds mit Gradle
Moderne Android Builds mit GradleModerne Android Builds mit Gradle
Moderne Android Builds mit Gradle
 
Hands on the gradle
Hands on the gradleHands on the gradle
Hands on the gradle
 
Hacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdfHacking the Codename One Source Code - Part IV - Transcript.pdf
Hacking the Codename One Source Code - Part IV - Transcript.pdf
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
 
Enter the gradle
Enter the gradleEnter the gradle
Enter the gradle
 
Config/BuildConfig
Config/BuildConfigConfig/BuildConfig
Config/BuildConfig
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
It's always your fault. Poznań ADG 2016
It's always your fault. Poznań ADG 2016It's always your fault. Poznań ADG 2016
It's always your fault. Poznań ADG 2016
 
7 maven vsgradle
7 maven vsgradle7 maven vsgradle
7 maven vsgradle
 
Разработка приложений в Android studio
Разработка приложений в Android studioРазработка приложений в Android studio
Разработка приложений в Android studio
 
Android gradle-build-system-overview
Android gradle-build-system-overviewAndroid gradle-build-system-overview
Android gradle-build-system-overview
 
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
Hello, Android Studio 3.2 & Android App Bundle @ I/O Extended Bangkok 2018
 
Modularisation avec Gradle et Dagger
Modularisation avec Gradle et DaggerModularisation avec Gradle et Dagger
Modularisation avec Gradle et Dagger
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDK
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Gradle presentation

  • 1. Gradle not just an ANT replacement
  • 2. Goals of Gradle (from official docs) ● Make it easy reuse code and resources (.aar) ● Make it easy to create several variants of an application ● Make it easy to configure, extend and customize the build process ● Good IDE integration
  • 3. About Gradle ● Is based on groovy: ○ binary-compatible with java ○ Most java code is syntactically valid on Groovy ○ The gradle installation comes with groovy ● You better use a gradle wrapper for your android projects
  • 4. Android Studio ● If something goes wrong, use gradle on the command line ● use this button: ● One update can “break” your project ● If something goes wrong, use gradle on the command line
  • 5. Basic gradle config buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.6.0+' } } apply plugin: 'android' android { compileSdkVersion 19 }
  • 6. Adding libs dependencies { // MavenCentral deps compile 'com.android.support:support-v4:19.0.0' compile 'com.android.support:appcompat-v7:19.0.0' compile 'com.squareup.retrofit:retrofit:1.2.2' compile 'com.squareup.okhttp:okhttp:1.2.1' // project dep: compile project(“:libraries:lib1”) // jar dep: compile files(‘libs/a.jar”, “libs/b.jar”) compile fileTree(dir: “libs”, include: “*.jar”) }
  • 7. Basic gradle commands $ gradle tasks $ gradle tasks --all $ gradle assembleDebug $ gradle assembleRelease $ gradle clean $ gradle installDebug $ gradle uninstallAll
  • 8. Gradle build customization android { compileSdkVersion 19 defaultConfig { versionCode 1 versionName "1.0" minSdkVersion 16 targetSdkVersion 16 } }
  • 9. Build Types buildTypes { debug { packageNameSuffix ".debug" } release { runProguard true proguardFile getDefaultProguardFile('proguard-androidoptimize.txt') } } $ gradle installFreeDebug
  • 10. Build Variants productFlavors { free { packageName "com.bitcoinlab.android.free" buildConfig “public static final boolean FULL_VERSION = false;” } full { packageName "com.bitcoinlab.android.full" versionName "2.0" versionCode 20 buildConfig “public static final boolean FULL_VERSION = true;” signingConfig signingConfigs.myConfig } }
  • 11. Build Variants specific files & deps src/full/java/src/”packagename”/file.java src/full/res/values/strings.xml src/full/AndroidManifest.xml dependencies { fullCompile ‘com.squareup.okhttp:okhttp:1.2.1' } A source file can’t exists on main src folder and at the same time on a flavour src folder: put a class into main, or in every buildType but not both.
  • 12. BuildConfig import java.text.SimpleDateFormat def buildTime() { def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'") df.setTimeZone(TimeZone.getTimeZone("UTC")) return df.format(new Date()) } defaultConfig { buildConfig """ public static final String GIT_SHA = "${gitSha()}"; public static final String BUILD_TIME = "${buildTime()}"; """ }
  • 14. Some things you can do with gradle ● free/paid apk ● debug/release version ● beta/alpha/”any git branch” apk ● Use multiple flavors + multiple-apk play store support to distribute smaller apks (depending on screen size or android version) ● build your customized integration and test server in minutes