Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

android - Proguard claims to obfuscate the .apk, but does not

I'm exporting an Android application from Eclipse. Proguard thinks it is obfuscating the .apk according to the console, dump.txt, mapping.txt, seeds.txt and usage.txt output, but when I decompile the .apk itself it is not obfuscated. Names of classes and fields are intact. I have tried various different Proguard configs but there doesn't seem to be anything wrong in terms of the configs. I make sure to clean the project so the classes.dex file won't be outdated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This worked for me in Eclipse Neon:

  1. Right click on project and add the Gradle nature

  2. File -> Export -> Android -> Generate Gradle build files

  3. In the root directory of your project, create a local.properties file and set sdk.dir. See: Where does local.properties go for android project?

  4. Right click on project -> Gradle -> Refresh Gradle Project

  5. Enable code shrinking in build.gradle. See: https://developer.android.com/studio/build/shrink-code.html

  6. Put your Proguard configuration in proguard-rules.pro (or in a different file if you set the proguardFiles property in build.gradle accordingly)

  7. Open the Gradle Tasks view and run the assembleRelease task. Check the console to see if it ran successfully. If it went well, refresh your project directory and the .apk file(s) will be in the build/outputs/apk subdirectory.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...