0

i am trying to protect my apk file by using proguard to prevent hackers from easily decompiling my code. I have followed many tutorials online on how to do this but my application crushes when i follow the advice online. The tutorials i have followed are on:

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

The project.properties file in my source directory looks like :

# 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

When i attempt to Export the signed apk , the following error is displayed in the console:

[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

line 14 is the line target=android-18 in the project.properties file.

can someone please help me fix this error that i am getting. :)D

Community
  • 1
  • 1

2 Answers2

0
proguard.config=proguard-project.txt

Use this instead of

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
Arunkumar
  • 224
  • 2
  • 6
  • i still get the same error. The change didn't help .what could be wrong ? – nyatsimbamutota Nov 16 '14 at 15:47
  • is your project name, class names or your folder name contains special characters.. such as spaces or '(' – Arunkumar Nov 17 '14 at 05:39
  • the error i am getting when exporting is the one i have posted in the question. could it be that there is an error with my IDE or there is a another file that i need to modify @Arunkumar – nyatsimbamutota Nov 17 '14 at 21:31
0

I have found a quick fix. Un-comment the line

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

in the project.properties file ; clean your project ; compile and run/load your project for about 10 times onto your test device. After a while, a folder named Proguard will appear in your main directory and there will be 4 text files inside of it. Do not temper with this folder. When you now want to export your apk, comment the above line & your apk will be exported without you encountering any erroes. I tried to decompile the apk i exported but the code seems obstructed with Proguard and is very difficult to reverse engineer.

This is a very weird solution but it has worked for my project.