Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: add obfuscation rules and use minify #17

Open
vhaudiquet opened this issue Jan 10, 2022 · 0 comments
Open

Enhancement: add obfuscation rules and use minify #17

vhaudiquet opened this issue Jan 10, 2022 · 0 comments

Comments

@vhaudiquet
Copy link

If this app is here to showcase how librespot can be included in an Android app, i think it would be good to show the minimal proguard rules that should be added so that you can enable 'minify' for release configurations.

I went trough the hassle of testing that for my app, here are the rules i could come up with :

# The spotify librespot player needs an 'output class'
# for it's audio output ; we need to keep that
-keep class xyz.gianlu.librespot.android.sink.AndroidSinkOutput

# librespot needs reflexion to work internally
# Here we keep the classes it needs
-keep class xyz.gianlu.librespot.mercury.MercuryRequests$GenericJson
{
    <init>(com.google.gson.JsonObject); # method <init> i.e. constructor
}
-keep class xyz.gianlu.librespot.mercury.MercuryRequests$ResolvedContextWrapper
{
    <init>(com.google.gson.JsonObject); # method <init> i.e. constructor
}
-keep class com.spotify.** {*;}
-keep class xyz.gianlu.librespot.audio.decoders.** {*;}

(from https://github.com/vhaudiquet/BladePlayer/blob/master/app/proguard-rules.pro)

I did not check what was needed for the Android Native decoder or the Tremolo decoder as i don't use them in my app for now.

It appears to be working keeping only those classes, and it cuts in half my app size.
I hope it can be useful to other people, this is why i'm sharing this here (and i think it should be included in the project, either in the proguard rules file or in the readme/documentation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant