Always run proguard before Android dex'ing in Eclipse

Is there a way to force Eclipse to always run proguard before dex'ing when trying to launch an Android app? for example, is it somehow easy to insert it as an assembly step?

By default, it will work when exporting, but I need it to always start, even when, for example, just doing the usual โ€œRunโ€ or โ€œDebugโ€ from the menu / keyboard.


For context, the reason this is relevant is because I run โ€œtoo many opcodes / without extended opcodesโ€ (http://code.google.com/p/android/issues/detail?id=26203) with my build in Eclipse. This is not a problem to build ant, because they run proguard, which removes all unused code. So far, I manually removed unused things from third-party dependencies, but this is somewhat ridiculous.

Also, as a side benefit, this should speed up my build significantly, because shrink-only run concessions are a way, a path faster than dex'ing, and it removes most of the code that should be dex'ed.

+6
source share
1 answer

This behavior is hardcoded in the Eclipse plugin builder in Android Development Tools. You can adapt your source code ( Android Tools ), so the builder behaves more like an export wizard (or inside, the BuildHelper class behaves more like an ExportHelper class). It may not be very interesting to maintain.

Alternatively, you can run Ant from Eclipse.

In addition, the commercial, twin source from ProGuard, DexGuard , combines the functions of ProGuard and dx (and apkbuilder, jarsign, zipalign). It can be configured for compression / obfuscation / optimization for debug / release builds in Eclipse and Ant.

(I'm a developer of ProGuard and DexGuard)

+7
source

Source: https://habr.com/ru/post/919640/


All Articles