1

How can I protect my application's APK from decompilation using proguard?

systempuntoout
  • 71,966
  • 47
  • 171
  • 241
MithunRaj
  • 543
  • 2
  • 7
  • 19
  • You're going to have to be more specific here. What's APK and Progaurd? Do you require help beyond what the user manual provides? If you're an advertiser, don't bother. – Robert Harvey Jul 06 '12 at 06:08
  • 5
    Robert, it appears you are not familiar with the subject matter. Proguard is included in the android sdk, and android is a tag supplying that context to the question. – Chris Stratton Jul 06 '12 at 06:14
  • 5
    @RobertHarvey What on earth is wrong with this question? `apk` files are the standard output for Android projects. ProGuard ships with the Android sdk but there are Android-specific instructions for using it. OP just wants to know what they are. Where did advertising come into this? – Ted Hopp Jul 06 '12 at 06:14
  • 3
    Still, even knowing the definition of APK and ProGuard, this seems extremely broad and doesn't tell us anything about what the asker tried. – jamesmortensen Jul 06 '12 at 06:58
  • possible duplicate of [How to make apk Secure. Protecting from Decompile](http://stackoverflow.com/questions/6235290/how-to-make-apk-secure-protecting-from-decompile) – jamesmortensen Jul 06 '12 at 07:03
  • @jmort253 - As an Android programmer, the question seems to me to be quite specific: "How do I turn on ProGuard in my Android project?" It's a beginner's question. I don't think the question shows much in the way of research, but if OP is a novice, it's appropriate to cut some slack. He may not even know where to start looking. Not everyone has l33t S34RcH SK1Ll2. (P.S. I wouldn't dispute closing the question as a duplicate; I don't think it should have been closed as being "not a question".) – Ted Hopp Jul 06 '12 at 07:06
  • 4
    @TedHopp - I'm not sure I agree. I think there's a difference between a beginner question and one that shows no research where the tutorial is right there on the first page of Google. With that said, I applaud you for trying to be helpful and welcoming to new users and giving the benefit of the doubt.... Maybe the op can add some more details? That would definitely eliminate any doubt, IMHO, and would make the question a stronger resource for future visitors. It's never too late to make edits ;) – jamesmortensen Jul 06 '12 at 07:11
  • 2
    Hi Mithun, welcome to SO! Don't take the comments the wrong way ;). We try really hard to keep our site really focused and on-topic. I think that if you could just tell us in an edit what you tried so far and where you're stuck exactly, this would be a great question and would help eliminate controversy! Don't take this feedback the wrong way ;) Welcome to Stack Overflow! – jamesmortensen Jul 06 '12 at 07:14

1 Answers1

10

If you're using Eclipse with the latest SDK release, just open the project.properties file in your project directory, read the instructions, and uncomment the appropriate line. ProGuard will run when you export your signed application. (It won't run for debug builds, so you can easily debug and also read stack traces.)

Read the developer docs for ProGuard in Android for more information.

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
  • I have one doubt regarding this. I did not add ProGuard in my app at apps development time. Its already released. If I add ProGuard in the app now and release as update, will it affect the app? Is there any other things to notice when compiling app after adding ProGuard? I heard that adding proguard need to modify code. – MithunRaj Jul 04 '13 at 08:22
  • 1
    @MithunRaj - Adding ProGuard use in a new app release should have no effect. In the vast majority of cases, using ProGuard has no effect at all on app functionality. In rare instances, you need to change the default ProGuard configuration. The most common of these rare instances is when you are using a class only through reflection. I've not heard of any circumstances where using ProGuard requires code changes. (Perhaps someone had in mind avoiding use of reflection, but that can be handled by simply telling ProGuard to keep the class(es) in question, rather than changing the code.) – Ted Hopp Jul 04 '13 at 16:16