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
Developing an Android library
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Dino Kovač
September 17, 2016
Programming
130
0
Share
Developing an Android library
Slides from my barcamp talk at Droidcon Vienna 2016.
Dino Kovač
September 17, 2016
More Decks by Dino Kovač
See All by Dino Kovač
Continuous integration and deployment on Android (plus some sweets)
reisub
1
610
Kickstart your Android development
reisub
1
82
Continuous integration and deployment on Android
reisub
0
230
Other Decks in Programming
See All in Programming
GoogleCloudとterraform完全に理解した
terisuke
1
200
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
440
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
190
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
1.8k
SkillsをS3 Filesに置く時のあれこれ
watany
3
1.6k
Are We Really Coding 10× Faster with AI?
kohzas
0
170
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
820
継続的な負荷検証を目指して
pyama86
3
1.2k
Import assertionsが消えた日~ECMAScriptの仕様はどう決まり、なぜ覆るのか~
bicstone
2
180
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
1.1k
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
510
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
Featured
See All Featured
Optimizing for Happiness
mojombo
378
71k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
690
Typedesign – Prime Four
hannesfritz
42
3k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
BBQ
matthewcrist
89
10k
Balancing Empowerment & Direction
lara
6
1.1k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
120
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Color Theory Basics | Prateek | Gurzu
gurzu
0
310
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
390
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.4k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
230
Transcript
Developing an Android library DINO KOVAČ
01 WHY?
WHY A LIBRARY? • DRY - don’t repeat yourself •
easier than copy/pasting classes
WHY AN OPEN SOURCE LIBRARY? • saving others time •
useful contributions from community • eternal fame!
02 WHAT?
DOES IT MAKES SENSE TO BUILD IT? • is there
a real need? • any existing libraries?
PICK A GOOD NAME • one that doesn’t already exist
• should make sense • bonus points if it’s amusing • example: • HTTParty - Makes http fun again!
03 HOW?
MIND THE API • primary way users interact with your
lib • make it easy to use • make it robust (avoid footguns!)
None
HTTPURLCONNECTION HttpURLConnection urlConnection = null; try { URL url =
new URL("https://api.github.com/markdown/raw"); connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setChunkedStreamingMode(0); OutputStream out = new BufferedOutputStream(connection.getOutputStream()); writeStream(out); InputStream in = new BufferedInputStream(connection.getInputStream()); readStream(in); } catch (IOException e) { // handle this } finally { if (connection != null) { connection.disconnect(); } }
HTTPURLCONNECTION
OKHTTP Request request = new Request.Builder() .url("https://api.github.com/markdown/raw") .post(RequestBody.create(MediaType.parse("text/plain"), "post body"))
.build(); try { Response response = client.newCall(request).execute(); } catch (IOException e) { // handle this }
FAIL FAST • as much validation as reasonably possible •
fail as fast as possible
FAIL FAST public Builder post(RequestBody body) { return method("POST", body);
} public Builder method(String method, RequestBody body) { if (method == null || method.length() == 0) { throw new IllegalArgumentException("method == null || method.length() == 0"); } if (body != null && !HttpMethod.permitsRequestBody(method)) { throw new IllegalArgumentException("method " + method + " must not have a request body."); } if (body == null && HttpMethod.requiresRequestBody(method)) { throw new IllegalArgumentException("method " + method + " must have a request body."); } this.method = method; this.body = body; return this; }
DON’T EXPOSE THE INTERNALS • package-protected classes • private or
protected methods
APP RESOURCES LIBRARY RESOURCES MERGED RESOURCES
APP RESOURCES LIBRARY RESOURCES MERGED RESOURCES @string/app_name @string/app_name @string/app_name
APP RESOURCES LIBRARY RESOURCES MERGED RESOURCES @string/app_name (en) @string/app_name (fr)
@string/app_name (de) @string/app_name (en) @string/app_name (fr) @string/app_name (de) @string/app_name
ANDROID SPECIFICS • build.gradle • resourcePrefix 'dbinspector_'
WRITE THE DOCS • what does it do? • how
do I use it? • maybe an example app?
DISTRIBUTE • don’t use maven central, use jcenter • automate
deployment
SHAMELESS SELF-PROMOTION • https://github.com/infinum/android_dbinspector • https://github.com/reisub/HttPizza
Any questions?
[email protected]
@DINO_BLACKSMITH Visit infinum.co or find us on
social networks: infinum.co infinumco infinumco infinum