Ankit
Ankit

Reputation: 491

Proguard setting in eclipse

Whats the difference between

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt

and

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

when I'm using 1st one its crashing with facebook login, but not when i use second, it'll not crash (in release build).

but size get increase from 4 to 5 MB in second. I'm using API 21. Facebook sdk 3.0

Upvotes: 0

Views: 211

Answers (1)

Gil Moshayof
Gil Moshayof

Reputation: 16771

Without seeing the contents of the proguard files, I can only guess, but I think it's fair to assume that proguard-project.txt contains definitions to keep class names / methods / members / etc relating to the Facebook SDK.

The reason it's crashing in the 1st setting is because it doesn't include your project's proguard settings, meaning it minifies more than the 2nd setting (including the Facebook SDK). Then, in release, the Facebook SDK is possibly loading a class / invoking a method via reflection or something similar, and crashing because it can't find a method / class name which has been minified.

This is also why the 2nd setting results in a larger binary - minifcation means smaller binary, since every class is being reduced from "SomeLongClassName" to "a". The more you minify, the smaller (and more efficient) the resulting binary is.

Minification is an optimization, and shouldnt (IMO) have a higher priority than code coherence and architecture. If you need to exclude several items from minification (which your ProGuard probably does with the Facebook SDK), then you should, and you shouldn't worry about the resulting APK size.

Upvotes: 1

Related Questions