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
Building the Fabric SDKs - #MBLTDev (30 min)
Search
Ty Smith
October 28, 2014
Programming
3
190
Building the Fabric SDKs - #MBLTDev (30 min)
Ty Smith
October 28, 2014
Tweet
Share
More Decks by Ty Smith
See All by Ty Smith
Balancing Speed and Reliability: The Double-Edged Sword of Third-Party Libraries
tysmith
1
56
Mobile Developer Productivity at Uber Scale [Droidcon NYC 2022]
tysmith
6
2.2k
Building for Developers - Droidcon Italy 2019
tysmith
1
210
Tools of the Trade #DCNYC18
tysmith
5
250
ADDC 2018 - Ty Smith: Building for Developers
tysmith
2
120
Deep Android Integrations
tysmith
4
1.3k
Better Android Development with Kotlin and Gradle
tysmith
10
1.1k
Better Android Development with Kotlin and Gradle
tysmith
9
1.5k
App To Ap: Designing Local APIs On Android
tysmith
1
250
Other Decks in Programming
See All in Programming
Rails アプリ地図考 Flush Cut
makicamel
1
110
Pulsar2 を雰囲気で使ってみよう
anoken
0
230
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
160
法律の脱レガシーに学ぶフロントエンド刷新
oguemon
5
730
2024年のWebフロントエンドのふりかえりと2025年
sakito
1
230
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
180
WebDriver BiDiとは何なのか
yotahada3
1
140
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
41
15k
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
[JAWS-UG横浜 #80] うわっ…今年のServerless アップデート、少なすぎ…?
maroon1st
1
170
2,500万ユーザーを支えるSREチームの6年間のスクラムのカイゼン
honmarkhunt
6
5.1k
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
Featured
See All Featured
Docker and Python
trallard
44
3.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
8
270
Designing Experiences People Love
moore
139
23k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.5k
Rails Girls Zürich Keynote
gr2m
94
13k
The Cost Of JavaScript in 2023
addyosmani
47
7.3k
Writing Fast Ruby
sferik
628
61k
How to Ace a Technical Interview
jacobian
276
23k
Facilitating Awesome Meetings
lara
51
6.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Statistics for Hackers
jakevdp
797
220k
How to train your dragon (web standard)
notwaldorf
90
5.8k
Transcript
dev.twitter.com @tsmith Building the Fabric SDKs Ty Smith Sr. Android
Engineer
None
None
None
None
Fabric Sample App Cannonball Open source for iOS & Android:
github.com/twitterdev
Powerful Lightweight
Powerful
Ease of Integration
Ease of Integration Fabric.with(this, new Crashlytics());
Extensible
Extensible Crashlytics.start(this);
Extensible Crashlytics.start(this, 5); Crashlytics.setListener(createCrashlyticsListener()); Crashlytics.setPinningInfo(createPinningInfoProvider()) Crashlytics.getInstance().setDebugMode(true);
Extensible Crashlytics.setListener(createCrashlyticsListener()); Crashlytics.setPinningInfo(createPinningInfoProvider()); Crashlytics.getInstance().setDebugMode(true); Crashlytics.start(this, 5);
Extensible Crashlytics.start(this, delay, listener, pinningInfo, debugMode);
Extensible Crashlytics.start(this, 0, null, null, null, true);
Fluent Pattern Crashlytics crashlytics = new Crashlytics.Builder() .delay(1) .listener(createCrashlyticsListener()) .pinningInfo(createPinningInfoProvider())
.build(); Fabric.with(this, crashlytics);
Fluent Pattern Fabric.with(new Fabric.Builder(this) .kits(new Crashlytics()) .debuggable(true) .logger(new DefaultLogger(Log.VERBOSE)) .looper(getCustomLooper())
.executor(getCustomExecutorService()) .build());
Extensible Classes class MyApiClient extends TwitterApiClient { interface MyService {
@GET(“/1.1/statuses/show.json”) Tweet getTweet(@Query(“id”) int id); } MyService getMyService() { return getService(MyService.class); } }
Gracefully Degrade
Gracefully Degrade if (TextUtils.isEmpty(apiKey) if (debuggable){ throw new IllegalArgumentException( “apiKey
is null!"); } else { return null; } }
Minimizing Permissions
Minimizing Permissions <uses-permission android:name="android.permission.INTERNET"/>
Minimizing Permissions Crashlytics.setUserEmail(“
[email protected]
”);
Permissions: Runtime Detection protected boolean canCheckNetworkState() { String permission =
Manifest.permission.ACCESS_NETWORK_STATE; int result = context.checkCallingOrSelfPermission(permission); return (result == PackageManager.PERMISSION_GRANTED); }
Multiple Application Types
Multiple Application Types package com.example; import android.app.Service; public class MyService
extends Service { }
UI from Application Context WeakReference<Activity> currentActivity = new WeakReference<Activity>(); @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void registerLifecycleCallbacks() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) { final Application app = ((Application)context); app.registerActivityLifecycleCallbacks( new ActivityLifecycleCallbacks() { @Override public void onActivityResumed(Activity activity) { currentActivity.set(activity); } }); } }
Powerful SDKs Ease of Integration Extensibility Support all app types
Permission detection
Lightweight
Binary Size
Binary Size
3rd Party Library Mindfulness
3rd Party Library Mindfulness
How big are Fabric AARs? Fabric: 190kb Crashlytics: 90kb Beta:
13kb Answers: 20kb Twitter API & SSO: 296kb Tweet UI: 120kb Tweet Composer: 5kb Digits: 236kb
3rd Party Library Mindfulness PROTOBUF KB OURS KB
Dalvik Method Count
Dalvik Method Count >./gradlew assemble … Unable to execute dex:
method ID not in [0, 0xffff]: 65536 Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
Dalvik Method Count > git clone
[email protected]
:mihaip/dex-method-counts.git > cd dex-method-counts
> ant jar > ./dex-method-counts path/to/App.apk Read in 65490 method IDs. <root>: 65490 : 3 accessibilityservice: 6 bluetooth: 2 content: 248 pm: 22 res: 45 ... com: 53881 adjust: 283 sdk: 283
Minimize Network Usage
Network Usage 10X SMALLER 100X FASTER XML PROTOBUF
Reduce Startup Time
Startup Time Thread.start(); Executors.newSingleThreadExecutor();
Startup Time class MyThreadFactory implements ThreadFactory { @Override public Thread
newThread(Runnable runnable) { final Thread thread = new Thread(runnable); thread.setPriority(Process.THREAD_PRIORITY_BACKGROUND); return thread; } }
Lightweight SDKs Binary size 3rd party library mindfulness Dalvik Method
Count Network usage Startup time
Lightweight Powerful
Questions? dev.twitter.com @tsmith