Proguard 简单示例错误

发布于 2024-12-02 01:22:00 字数 1165 浏览 0 评论 0原文

这是我第一次使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浴红衣 2024-12-09 01:22:00

升级到 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文