Proguard 简单示例错误
这是我第一次使用 Proguard。我正在使用以下代码在示例项目中对其进行测试(仅用于检查堆栈跟踪何时被混淆),
package com.proguardtest;
import android.app.Activity;
import android.os.Bundle;
public class ProguardTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
Integer.parseInt("Test");
} catch (Exception e){
e.printStackTrace();
}
}
}
因此我创建了一个新项目并转到该文件: default.properties 并添加生成文件的行
proguard.config=proguard.cfg
:# 该文件由 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 use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-7
proguard.config=proguard.cfg
然后,我尝试使用导出向导(Eclipse Windows)生成 apk,在最后一步,当我选择 apk 的路径时,会出现一个错误对话框,显示转换为 dalvik 失败。
我做错了什么?
提前致谢
Is my first time using Proguard. I'm testing it in a example project with following code (Just for check when the stacktrace is obfuscated)
package com.proguardtest;
import android.app.Activity;
import android.os.Bundle;
public class ProguardTestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
Integer.parseInt("Test");
} catch (Exception e){
e.printStackTrace();
}
}
}
So I create a new project and go to the file:
default.properties and add the line
proguard.config=proguard.cfg
thats the resulting file:# 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 use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-7
proguard.config=proguard.cfg
Then I try to generate the apk with the export wizard (Eclipse Windows) and at the last step when I have selected the path for the apk a error dialog appears showing Conversion to dalvik failed.
What am I doing wrong?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
升级到 ProGuard 4.6(下载,解压 .zip 文件,复制到..\android-sdk\tools\proguard)
Upgrade to ProGuard 4.6 (download it, extract the .zip file, copy to ..\android-sdk\tools\proguard)