我正在使用最新的SDK开发Android APP。我正在为Api 4(android 1.6)开发应用程序。
我的项目有一个 proguard-project.txt 文件(这是最新版本的Android SDK的proguard配置文件),而project.properties文件已经取消了proguard的行,所以proguard已激活(proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt)
问题是我用proguard编译了apk文件,似乎proguard在文件中什么也没做,我反编译了apk并显示了与不使用proguard时相同的代码。我的 proguard-project.txt 也是空的。它只包含评论...
这是我自动生成的 proguard-project.txt 文件的内容:
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
我必须添加到此文件中以进行混淆,优化和减小我的apk文件的大小? (至少可以对代码进行模糊处理......)
由于
答案 0 :(得分:2)
Android SDK仅在使用ant release
创建发布版本或在Eclipse中导出apk时应用ProGuard。