Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Gradle and Android Studio
Search
Fede
September 25, 2014
Programming
0
130
Gradle and Android Studio
Info and tips of Gradle and Android Studio
Fede
September 25, 2014
Tweet
Share
More Decks by Fede
See All by Fede
Spark Streaming Tips for Devs & Ops
fedefernandez
0
95
Scala on Android - The current state of affairs
fedefernandez
0
44
Functional Views on Android
fedefernandez
0
600
Other Decks in Programming
See All in Programming
条件判定に名前、つけてますか? #phperkaigi #c
77web
1
270
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
260
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
110
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
420
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
220
Codex の「自走力」を高める
yorifuji
0
1.2k
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
0
130
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
310
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
750
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
150
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.9k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
680
Featured
See All Featured
Optimizing for Happiness
mojombo
378
71k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
560
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
290
Testing 201, or: Great Expectations
jmmastey
46
8.1k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
64
53k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.5k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
130
Ethics towards AI in product and experience design
skipperchong
2
230
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
210
Google's AI Overviews - The New Search
badams
0
930
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Transcript
Info and tips for Gradle and Android Studio
Google Plus plus.google.com/+FedeFdez Twitter @FedeProEx Web projectsexception.com
Eclipse / Ant Maven Gradle Android Build System
None
Single Build System Build from command line or your IDE
Default folder structure Tasks for build, test, install,...
Simplify AndroidManifest Version code and version name Package identifier Minimum
and target sdk Placeholder support
Build Types Debug, release and your owns Add application id
and name suffixes Signing Configurations Running proguard
Dependency Management Local packages Build type specific dependency No need
to distribute the dependencies Multi project support
None
1 android { 2 compileSdkVersion 19 3 buildToolsVersion '19.0.0' 4
5 defaultConfig { 6 applicationId 'com.example.app' 7 versionCode 12 8 versionName '2.0' 9 minSdkVersion 16 11 targetSdkVersion 16 12 } 13 } Simplify Manifest
1 android { 2 buildTypes { 3 debug { 4
applicationIdSuffix '.debug' 5 versionNameSuffix '-debug' 6 } 7 release { 8 runProguard true 9 proguardFiles 'file1.pro', 'file2.pro' 10 signingConfig signingConfigs.mySignConfig 11 } 12 } 13 } Build Types
1 android { 2 signingConfigs { 3 mySignConfig { 4
storeFile = file(project.property('file')) 5 storePassword = project.property('password') 6 keyAlias = project.property('keyAlias') 7 keyPassword = project.property('keyPassword') 8 // Command line or environment variable 9 // System.console().readLine("\n\$ Password: ") 10 // System.getenv("KEYSTORE") 11 } 12 } 13 } Signing Config
1 dependencies { 2 // All jar in libs folder
3 compile fileTree(dir: 'libs', include: ['*.jar']) 4 // Dependency from repository 5 compile 'com.android.support:support-v4:20.0.0' 6 // Library project in same folder 7 compile project(':library-project') 8 // Dependency for release build 9 releaseCompile 'com.google.code.gson:gson:2.3' 10 } Dependencies
None
Flavors Application variants Same type as the android.defaultConfig Flavor specific
dependencies Build Type + Product Flavor = Build Variant
Multi-Flavors Distinct dimensions Flavors are assigned to a specific dimension
Combine dimensions to create de app
1 flavorDimensions 'type', 'store' 2 productFlavors { 3 full {
4 flavorDimension 'type' 5 } 6 lite { 7 flavorDimension 'type' 8 } 9 amazon { 10 flavorDimension 'store' 11 } 12 play { 13 flavorDimension 'store' 14 } Flavors fullAmazonDebug fullAmazonRelease liteAmazonDebug liteAmazonRelease fullPlayDebug fullPlayRelease litePlayDebug litePlayRelease
Source Sets Build Types and Product Flavors have their own
sourceSet src/main, src/<buildType1>, src/<flavor1>,... Source code (src/*/java) generate a single output Manifests are all merged Resources using priority: BuildType > Flavor > Main
1 <manifest> 2 <application> 3 <activity> 4 <!-- --> 5
</activity> 6 </application> 7 </manifest> Manifest Merge 1 <manifest> 2 <uses-permission> 3 </manifest> 1 <manifest> 2 <uses-permission> 3 <application> 4 <activity> 5 <!-- --> 6 </activity> 7 </application> 8 </manifest> 1 2 3
Gradle + Android Studio
Android Studio vs Eclipse AS Eclipse Build system Gradle Ant
Maven-based build dependencies Yes No Build variants and multiple-APK generation Yes No Advanced Android code completion and refactoring Yes No Graphical layout editor Yes Yes APK signing and keystore management Yes Yes NDK support Soon Yes
Some Features An IDE built for Android Gradle integration IntelliJ
IDEA is the base for Android Studio Preview resources (drawables, strings,...) Advanced layout editor (includes, xml drawables) Templates
None
None
None
None
None
None
None
Resources tools.android.com/tech-docs/new-build-system/user-guide plus.google.com/+PhilippeBreault github.com/keyboardsurfer/idea-live-templates stackoverflow.com/questions/tagged/gradle+android
None