Obfuscate Android apps?
I'm loving IDEA since I moved from Eclipse, a horrible piece of software (at least on Windows). I notice the next version of ADT will support Proguard directly, so the release build of the app has the debuggable flag set to false automatically AND the app can be obfuscated as part of the standard release process, that's a really great pair of time-savers.
Is there any way with IDEA 10 to implement Proguard obfuscation, or similar? Ideally I'd like to do it without creating an ANT script as I've no experience with ANT, and I'm just duplicating the perfectly good build process in IDEA.
I did try installing two plugins that pupport to support Proguard and yGuard, but although they show as installed, neither shows on the Facets/Modules menu, so I've no idea how to actually use them in my project, they just don't seem to work, but maybe I'm missing a configuration step.
Please sign in to leave a comment.
Nevertheless I suggest to give ANT, the quasi-standard build tool of Java, a
try. It will help you for much more Java build and distribution tasks than
obfuscating/shrinking. It also has the advantage that you can build it
without the need of an IDE, e.g. a build server.
Tom
I'm sure I can get to grips with ANT, but given the choice between spending time creating a parallel build process (which I don't have any need for, I'm a sole developer) and continuing to work on the app, it's better to work on the latter.
The easier the tools are to use the more time can go into the apps, where it belongs.
There are tasks which should be done by the IDE and some which shouldn't.
Building a distributable package IMHO belongs in the second category.
There are dozens of obfuscators - why IDEA should support your preferred
one? Because Eclipse does? Sorry, this is no argument.
Tom
I'm happy to use any obfuscator, but as far as I can see IDEA doesn't include one suitable for Android and I cannot get a plugin to work. The only reason I'd use ANT is to implement an obfuscator, and that's not a particularly good justification for the work involved if there's a way to do it in the IDE.
One-click deployment is a time saver for all projects, even if it is an investment in the beginning:
Hope that helps,
Dirk
P.S: There is Tools > Generate Ant Build... which will get you started.
I agree there are lots of benefits to using ANT, but none of those in that list apply to me right now. I'm a sole developer, nothing to share, no team, no build server, and I have just the two build modes, debug, and release, both of which are very quick and easy in the IDE. So although ANT has many benefits they're just inapplicable right now, and my goal is to "obfuscate the release build investing as little time as possible", and learning Ant looks counter to that goal. I have no experience with Ant, so the result will be me spending hours poring over the docs when I should be fixing bugs and adding features to my app.
I see the option under Build -> Generate Ant Build, but it produces two files that mean nothing to me at this point, and as I say my goal is to AVOID spending hours on this, not pick up another thing to learn when I'm on tight deadlines. You suggest it's essential to learn all this, and in an ideal world you're right, but the soon-to-be-released Eclipse add-ins from Google for Android dev will bring obfuscation in as a default part of the build process. I know our instinct as programmers is to understand everything, but something it's more important to just get the job done. I'm looking for the quickest and easiest way to get the job done. taking on a tool I am unfamiliar with doesn't seem the most obvious way to achieve that.
Do the plugins for yGuard and Proguard for IDEA not work? Is anyone using them?
So you are a "corner case".
You always will be on tight deadlines. Understanding how to write an ANT
script I rate as a must-have competence for a Java developer. But in
contrast with Dirk's suggestion, I'd rather would start with a small
hand-written ANT file instead of a generated one. (1)
ANT is. If you would have started with a simple ANT build file yesterday,
you already would have been ready and would save time with each new
requirement or project change in the future.
Tom
(1) When learning a new programming language, I prefer to start with the
basics: how to compile from command line. This helped me a lot to better
understand how things play together.
I agree Ant is important, but it's a matter of priorities in terms of what skills I pick up in what order. No-one can learn everything instantly. Inside a few weeks months I've re-learnt Java, learnt the Android platform, and learnt the functions I need in both Eclipse and IDEA. I'm doing very well with my progress, but amongst all of this I have an app to write! I have one 80% complete to a good standard, I'm very pleased to be at this point after a relatively short period of time. The reality is that if I had spent time yesterday learning how to build my project with Ant I would not have fixes the series of bugs I fixed yesterday and implemented the features I implemented yesterday. Picking up new skills has an initial cost, and we all have to decide when is the right time to incur that cost (time or money, for me both).
You seem to be saying that because Ant is easy for you I can click my fingers and be good at it too. I'm not you, I have time constraints, you have experience I don't. Adding obfuscation to my project using Ant is far from quick. It looks like the best solution is to use the new integrations from Google and dump IDEA to go back to Eclipse (a shame, but Android apps need obfuscating and it is clearly a tedious, inefficient PITA to do it with IDEA)
I agree about the value of going back to basics, but only for education, not in projects where that deeper-level work adds no value. I used to write ARM assembly language in the 1980s, but clearly I wouldn't write my Android apps in ARM assembly, it would be absurd. And to me re-creating the IDE's build process using parallel scripts is inferior to clicking a button marked "Build Release Version (Obfuscated)" when all I want to do is obfuscate and have no need for team builds, etc.
Are lone-developers a rare exception? Clearly not.
Well, you've asked for the quickest solution. I told you. It definitely
takes longer to integrate ProGuard into IDEA - for Jetbrains or for you
writing an IDEA plug-in or providing an IDEA patch - than using ANT. If you
don't want to use that option, I can't help you further.
Tom