Bug 12530 - ProGuard or Linker dead code elimination for included JARs
Summary: ProGuard or Linker dead code elimination for included JARs
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Tools and Addins ()
Version: 4.6.x
Hardware: PC Windows
: Low enhancement
Target Milestone: ---
Assignee: Atsushi Eno
URL:
Depends on:
Blocks:
 
Reported: 2013-06-03 21:59 UTC by Jeremy Kolb
Modified: 2015-02-26 12:18 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jeremy Kolb 2013-06-03 21:59:36 UTC
I'm noticing that my applications are really large in Xamarin (typically twice the size of the corresponding Java version).  I believe that this is because dead code isn't eliminated in the JAR binding projects that I'm using.
Comment 1 Jonathan Pryor 2013-06-04 12:00:31 UTC
I'm surprised that the code size is _only_ twice the size, given that the Mono runtime + (linked) class libraries are also included with your app...or are you looking at the Debug .apk size, not a Release .apk size?

What are you looking at for .apk sizes? :-)

> I believe that this is because dead code isn't eliminated in the 
> JAR binding projects that I'm using.

This is correct. It's also rather complicated to support, as the Java member references will be coming from C# code, and thus "invisible" to proguard. If we use proguard "normally", ~everything Java would get removed, and the app would crash at startup.
Comment 2 Jeremy Kolb 2013-06-04 13:09:52 UTC
It was more of an anecdotal example based on the size of the release apk and the size of the installed program on the device (which is much larger as well).

Couldn't you just link the C# and then as a separate step run proguard on just the Java portions and then link everything again?  The first step would eliminate the dead C# from the bindings and then proguard would remove the unreferenced Java code.  It wouldn't be exhaustive but for some of the larger jars it could help a lot.
Comment 3 Atsushi Eno 2013-06-04 20:06:02 UTC
While I had some early stage attempt to use proguard many months ago, it's too early to assign me on "not sure who is going to work on it in the far future" task.
Comment 4 Jeremy Kolb 2014-05-21 14:13:16 UTC
Any update or ideas on how to do this?  I found XamGuard but it doesn't work out of the box for me.
Comment 5 Jeremy Kolb 2014-10-29 13:33:55 UTC
This is becoming a problem for me as distributing off the app store (to private customers for instance) is made more difficult by the increased file sizes.
Comment 6 Atsushi Eno 2014-10-29 20:19:35 UTC
We're on experimental phase to support it. This Xamarin Evolve 2014 LT slides explain how to use it.
https://docs.google.com/a/xamarin.com/presentation/d/1O36XjmNVHkwirmOMkd2dxiWVkq20SHrnDciSMKjDNo0/edit#slide=id.g3e1a04d56_010
Comment 7 Jeremy Kolb 2015-02-26 10:39:29 UTC
Is there a plan to make this easier to use?
Comment 8 Atsushi Eno 2015-02-26 12:18:18 UTC
In the next non-maintenance version you will be able to enable Proguard on the IDEs.

Closing the bug as FIXED.