1

I am trying to export my android application with proguard enabled when I get this error:-

 Proguard returned with error code 1. See console
 proguard.ParseException: Expecting java type before ' ' in line 79 of file 'C:\Documents and Settings\Acer.ACER-2487AA0235\My Documents\Eclipse\Myproject\proguard-project.txt',
included from argument number 4
at proguard.ConfigurationParser.checkJavaIdentifier(ConfigurationParser.java:1187)
at proguard.ConfigurationParser.parseMemberSpecificationArguments(ConfigurationParser.java:842)
at proguard.ConfigurationParser.parseClassSpecificationArguments(ConfigurationParser.java:697)
at proguard.ConfigurationParser.parseKeepClassSpecificationArguments(ConfigurationParser.java:490)
at proguard.ConfigurationParser.parse(ConfigurationParser.java:139)
at proguard.ProGuard.main(ProGuard.java:484)

Lines 77-80 from proguard-project.txt:-

-keepclassmembers class * 
{ 
 @android.webkit.JavascriptInterface <methods>;
}

Complete proguard-project:-

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keepattributes *Annotation*

-injars      bin/classes
-injars      libs
-outjars     bin/classes-processed.jar

-libraryjars /libs/com-rfhtaej-vskwgkw207826.jar


-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.preference.Preference
-keep class com.rfhtaej.vskwgkw207826.** {*;}
-dontwarn com.rfhtaej.vskwgkw207826.**



-keepclasseswithmembernames class * 
 {
    native <methods>;
 }

 -keepclasseswithmembers class * 
  {
    public <init>(android.content.Context, android.util.AttributeSet);
  }

 -keepclasseswithmembers class * 
  {
    public <init>(android.content.Context, android.util.AttributeSet, int);
  }

  -keepclassmembers enum * 
  {
    public static **[] values();
    public static ** valueOf(java.lang.String);
  }



  -keep class * implements android.os.Parcelable 
   {
     public static final android.os.Parcelable$Creator *;
   }

   -keepclasseswithmembers class **.R$** 
   {
    public static <fields>;
   }

  -keepclassmembers class * 
  {
    @android.webkit.JavascriptInterface<methods>;
  }
   -keep class * extends android.view.View 
    { 

      public <init>(android.content.Context); 
      public <init>(android.content.Context, android.util.AttributeSet); 
      public <init>(android.content.Context, android.util.AttributeSet, int); 
      void set*(***);
       *** get*();
    }

   -keepclassmembers class * 
    {
        static final %                *;
        static final java.lang.String *;
    }

-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

-dontwarn com.google.android.gms.**


-keepattributes SetJavaScriptEnabled
-keepattributes JavascriptInterface
-keepattributes InlinedApi

Any Ideas on how to solve this problem as my application is all complete and it sucks that I am unable to publish it because of an error at the last stage. Thank You.

Mohit
  • 1,045
  • 4
  • 18
  • 45

1 Answers1

1

I faced the same error and finally sorted it out by keeping the below line in the proguard-project.txt file

-libraryjars /libs/Your_Jar_File.jar

Just exclude jar file which ever you feel it is causing you the expection.

I am facing this issue due to one external jar file. Where proguard is obfuscating it. As in my case airpush jar file is creating the problem. Just exclude it.

sri2377076
  • 78
  • 2
  • 9
  • Yea, Here we are just excluding it from proguard. It remains in your project folder. Just try it out. Best of luck. If you feel this is useful Mark it as accepted. – sri2377076 Nov 26 '14 at 08:43
  • Still getting the same error. Maybe its code related as it is expecting a java type on the line. – Mohit Nov 26 '14 at 13:40
  • Post your total proguard content here. I will check and let you know the solution. – sri2377076 Nov 27 '14 at 06:44
  • I edited the post with complete proguard content, please go through it. thanks. – Mohit Nov 27 '14 at 09:11
  • ==> Please make things in detail WHICH SDK you are using ==> Have you included all the Proguard content into Proguard file of the project which they Suggest. (If you included Exclude those apart of "android.gms" ==> And to get free from your Error Include "-libraryjars /libs/Your_Jar_File.jar" ==> Just Update your POST if you got free from your Error. – sri2377076 Nov 28 '14 at 08:11
  • I just copy pasted the proguard content from airpush's document along with proguard content for google play services. Then I added your ` -libraryjars /libs/Your_Jar_File.jar` line. That's all there is. – Mohit Nov 28 '14 at 08:40
  • Ok, Just give me the Airpush Suggested proguard content. I will verify it and i will tell you what are the contents that you need to Exclude in your Proguard file. – sri2377076 Nov 28 '14 at 08:51
  • Here is the link:- http://manage.airpush.com/docs/index.php?title=Bundle_SDK_1.0_Documentation – Mohit Nov 28 '14 at 09:30