Reputation: 174
I am using proguard to secure my android apk from reverse engineering.
But when I completed all the steps which is needed to on proguard tool in my app then it gives error like bellow:
[2014-03-11 10:55:04 - DemoProApp] Proguard returned with error code 1. See console
[2014-03-11 10:55:04 - DemoProApp] proguard.ParseException: Expecting type and name instead of just '***' before '(' in line 85 of file 'D:\Ranjana\New folder\DemoProApp\bin\proguard.txt',
[2014-03-11 10:55:04 - DemoProApp] included from argument number 6
[2014-03-11 10:55:04 - DemoProApp] at `proguard.ConfigurationParser.parseMemberSpecificationArguments(ConfigurationParser.java:857)
[2014-03-11 10:55:04 - DemoProApp] at proguard.ConfigurationParser.parseClassSpecificationArguments(ConfigurationParser.java:697)
[2014-03-11 10:55:04 - DemoProApp] at proguard.ConfigurationParser.parseKeepClassSpecificationArguments(ConfigurationParser.java:490)
[2014-03-11 10:55:04 - DemoProApp] at proguard.ConfigurationParser.parse(ConfigurationParser.java:139)
[2014-03-11 10:55:04 - DemoProApp] at proguard.ProGuard.main(ProGuard.java:484)
[2014-03-11 10:55:04 - DemoProApp] '-jar' is not recognized as an internal or external command,
[2014-03-11 10:55:04 - DemoProApp] operable program or batch file.`
And my Proguard-project.txt file is like bellow:
-keep class com.google.ads.** # Don't proguard AdMob classes
-dontwarn com.google.ads.** # Temporary workaround for v6.2.1. It gives a warning that you can ignore
# Add any classes the interact with gson
-keep class com.example.Get_TargetTask
-keep class com.example.Get_Update_Task
-keep class com.example.GetAlertTask_CGM
-keep class com.example.GetAlertTask
-keep class com.example.GetApplicationDrawable
-keep class com.example.GetAssignedWorkTask
-keep class com.example.GetBarCode
-keep class com.example.GetRootTask
-keep class com.example.GetSignature
-keep class com.example.GetSmsTask
-keep class com.example.GuiNotificationActivity
-keep public class com.example.** {*;}
##---------------Begin: proguard configuration common for all Android apps ----------
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
-dump class_files.txt
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-allowaccessmodification
-keepattributes *Annotation*
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
-repackageclasses ''
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-dontnote com.android.vending.licensing.ILicensingService
# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# Preserve all native method names and the names of their classes.
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
# Preserve static fields of inner classes of R classes that might be accessed
# through introspection.
-keepclassmembers class **.R$* {
public static <fields>;
}
# Preserve the special static methods that are required in all enumeration classes.
1. keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class com.example.** { *; }
-keep public class * {
public protected *;
}
-keep class com.example.Assign_revert.java.** {
void set*(***);
void set*(int, ***);
boolean is*();
boolean is*(int);
*** get*();
*** get*(int);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
##---------------End: proguard configuration common for all Android apps ----------
##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
#-keep class com.google.gson.stream.** { *; }
# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { *; }
##---------------End: proguard configuration for Gson ----------
2. List item
Upvotes: 0
Views: 719
Reputation: 45676
The error message refers to line 85 of file proguard.txt
(not proguard-project.txt
). That line appears to be missing a method name inbetween the return type (the wildcard ***
) and the opening parenthesis for the method arguments.
Note that the Android SDK nowadays contains a standard configuration file that already specifies all the generic Android configuration for you (with -printseeds, -keepattributes, etc).
Upvotes: 1