在Eclipse中生成一個android項目時,Eclipse會自動生成一個project.properties文件,打開這個文件(下面以我寫的一個項目中的這個文件爲例),裏面的內容如下所示:
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
# Project target.
target=android-10
若想防止自己的勞動成果不被別人輕易地剽竊,就在這個project.properties文件中最後的地方添加這樣一句話:proguard.config=proguard.cfg ,添加後這個文件中的整體內容如下所示:
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
# Project target.
target=android-10
proguard.config=proguard.cfg
這樣處理之後生成的APK文件就能很好地防止反編譯了