Ty Smith discusses building lightweight yet powerful Fabric SDKs. The SDKs are easy to integrate, extensible to support different app types, minimize permissions and network usage, and reduce startup time and binary size. Fabric SDKs provide powerful functionality while remaining lightweight through techniques like using protocol buffers to reduce network traffic, setting lower thread priorities to decrease startup time, and minimizing included methods to reduce the Dalvik method count.
22. Gracefully Degrade
if (TextUtils.isEmpty(apiKey)
if (debuggable){
throw new IllegalArgumentException(
“apiKey is null!");
} else {
return null;
}
}
38. 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
44. 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;
}
}
45. Lightweight SDKs
Binary size
3rd party library mindfulness
Dalvik Method Count
Network usage
Startup time