Proguard/R8 mapping output

Would it be possible for the buildserver to keep the result of Proguard/R8 typically stored in build/outputs/mapping? This information allows to deobfuscate user provided crash reports. I am not yet sure if the mapping used differs for each build, or if I can get the exact same mapping by building locally. But even if the results were identical, it would be practical to be able to retrieve this information from F-Droid’s build server.

3 Likes

I agree. This info would be helpfull to translate human unreadable crashlogs back to something meaningfull.

As a workaround i add these lines to my apps proguard-rules.pro so that unused code is removed but classes and namespaces are not renamed so the crashlog remains readable


# Use proguard only to remove unused stuff and to keep the app small.
# Donot obfuscate (rename packages, classes, methods, ...) since this is open source
# so crashlogs are still readable
-dontobfuscate
-dontoptimize
-keepnames class ** { *; }
-keepnames interface ** { *; }
-keepnames enum ** { *; }
1 Like

You are obfuscating your FOSS app? If so, why?

Adding dontobfuscate flag to proguard increases apk-size, for example in case of current MyExpenses master branch, from 24512400 to 25089733. It is not much (2.355 %), but still a reason to not skip obfuscation in my opinion.

1 Like

Wait so… you want the app to be (marginally) smaller, but F-Droid should keep the cruft you’ve expunged to be helpful? :slight_smile: :slight_smile:

1 Like

That seems reasonable. Many user devices have limited storage and anything reasonable to save them space makes sense. In addition, some users have limited bandwidth for the download of apps. Storing the mapping file on a server and only downloading it when needed takes up space on only one device (the server) and saves repeated wasted bandwidth.

As a note, Google Play has the option of doing something similar, where developers can upload a copy of the mapping file so that crash reports can be decoded.

1 Like

For 20Mb yes, not for 500kb :slight_smile:

1 Like

This website loads the following JavaScript file, which has been minified:

https://forum.f-droid.org/assets/plugins/discourse-local-dates-e3ba622ea7a76e4f7c1405c8ca99bf4bc6414933d835ca7553eb7e3a0ae6f0f2.js

The process of minification of this file is similar to what Proguard/R8 does to an APK. Doing so likely saved far less than 500kb, and yet was considered useful enough that it was done. Is there some reason why this would make sense for a website but not for an app?

1 Like

Android users are weird about app size, I got some angry emails from people when the size of my app increased by 0.2 MB :smile:

@mtotschnig : what is the difference in apk size when you remove the line -dontoptimize ?

@k3b I am not setting -dontoptimize .

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.