【问题标题】:enabling proguard on android failing在android失败时启用proguard
【发布时间】:2014-11-14 10:57:13
【问题描述】:

我正在尝试通过使用 proguard 来保护我的 apk 文件,以防止黑客轻松反编译我的代码。我在网上遵循了许多关于如何做到这一点的教程,但是当我遵循在线建议时,我的应用程序崩溃了。我遵循的教程是:

Enabling ProGuard in Eclipse for Android

http://proguard.sourceforge.net/manual/examples.html#androidapplication

http://dominoc925.blogspot.com/2013/12/how-to-obfuscate-android-apk-file-using.html

我的源目录中的 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-18
android.library.reference.1=..\\appcompat_v7
android.library.reference.2=../../adt-bundle-windows-x86_64-20140702/sdk/extras/google    /google_play_services/libproject/google-play-services_lib

当我尝试导出已签名的 apk 时,控制台中显示以下错误:

[2014-11-14 12:41:18 - SMART calculator] Proguard returned with error code 1. See console
[2014-11-14 12:41:18 - SMART calculator] proguard.ParseException: Unknown option '(' in argument number 14
[2014-11-14 12:41:18 - SMART calculator]    at proguard.ConfigurationParser.parse(ConfigurationParser.java:191)
[2014-11-14 12:41:18 - SMART calculator]    at proguard.ProGuard.main(ProGuard.java:484)
[2014-11-14 12:41:29 - SMART calculator] Proguard returned with error code 1. See console

第 14 行是 目标=android-18 在 project.properties 文件中。

有人可以帮我解决我遇到的这个错误吗? :)D

【问题讨论】:

    标签: java android encryption apk proguard


    【解决方案1】:
    proguard.config=proguard-project.txt
    

    用这个代替

    proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
    

    【讨论】:

    • 我仍然遇到同样的错误。更改没有帮助。可能出了什么问题?
    • 是你的项目名、类名或者你的文件夹名包含特殊字符..比如空格或者'('
    • 我在导出时遇到的错误是我在问题中发布的错误。可能是我的 IDE 有错误,或者我需要修改另一个文件@Arunkumar
    【解决方案2】:

    我找到了一个快速解决方法。取消注释该行

    proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
    

    在 project.properties 文件中;清理你的项目;在您的测试设备上编译并运行/加载您的项目大约 10 次。一段时间后,一个名为 Proguard 的文件夹将出现在您的主目录中,其中将有 4 个文本文件。不要对这个文件夹发脾气。当您现在想要导出您的 apk 时,请在上面的行中添加注释,您的 apk 将被导出而不会遇到任何错误。我试图反编译我导出的 apk,但代码似乎被 Proguard 阻碍了,并且很难逆向工程。

    这是一个非常奇怪的解决方案,但它对我的项目有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-18
      • 2011-09-10
      • 1970-01-01
      • 2013-09-20
      • 1970-01-01
      相关资源
      最近更新 更多