Proguard Causes "The RequestFactory ValidationTool must be run" Error

172 views
Skip to first unread message

Double

unread,
Feb 29, 2012, 6:27:36 PM2/29/12
to google-we...@googlegroups.com
Title pretty much says it, when I have proguard enabled I get the error, when I disable it (or run in debug mode) everything is fine. Any help would be appreciated.


Stack Trace:
02-29 17:24:04.195: E/AndroidRuntime(18174): FATAL EXCEPTION: IntentService[at email]
02-29 17:24:04.195: E/AndroidRuntime(18174): java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the com.project.mms.a.a RequestFactory type
02-29 17:24:04.195: E/AndroidRuntime(18174): at com.google.e.a.c.b.a.b.a(Unknown Source)
02-29 17:24:04.195: E/AndroidRuntime(18174): at com.google.e.a.c.b.e.<init>(Unknown Source)
02-29 17:24:04.195: E/AndroidRuntime(18174): at com.google.e.a.c.b.h.a(Unknown Source)
02-29 17:24:04.195: E/AndroidRuntime(18174): at com.project.mms.w.a(Unknown Source)
02-29 17:24:04.195: E/AndroidRuntime(18174): at com.project.mms.o.a(Unknown Source)
02-29 17:24:04.195: E/AndroidRuntime(18174): at com.project.mms.C2DMReceiver.a(Unknown Source)
02-29 17:24:04.195: E/AndroidRuntime(18174): at com.google.android.c2dm.C2DMBaseReceiver.onHandleIntent(Unknown Source)
02-29 17:24:04.195: E/AndroidRuntime(18174): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
02-29 17:24:04.195: E/AndroidRuntime(18174): at android.os.Handler.dispatchMessage(Handler.java:99)
02-29 17:24:04.195: E/AndroidRuntime(18174): at android.os.Looper.loop(Looper.java:143)
02-29 17:24:04.195: E/AndroidRuntime(18174): at android.os.HandlerThread.run(HandlerThread.java:60)




Proguard file:

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

-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 com.android.vending.licensing.ILicensingService
-keep class info.guardianproject.database.** {*;}
-keep class info.guardianproject.database.sqlcipher.** {*;}
-keep class com.project.mms.ui.* {*;}

-libraryjars /libs/guava-r09.jar
-libraryjars /libs/commons-codec.jar
-libraryjars /libs/sqlcipher.jar
-libraryjars /libs/jsr305-1.3.9.jar
-libraryjars c:/android-sdk-windows/platforms/android-8/android.jar
-verbose

-dontwarn sun.misc.Unsafe

-keepclasseswithmembers class * {
    native <methods>;
}

-keepclasseswithmembers 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 *;
}

# Needed by google-api-client to keep generic types and @Key annotations accessed via reflection
-keepclassmembers class * {
  @com.google.api.client.util.Key <fields>;
}
-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
# Needed by Guava
-dontwarn sun.misc.Unsafe

Thomas Broyer

unread,
Mar 1, 2012, 4:53:32 AM3/1/12
to google-we...@googlegroups.com
RequestFactory uses the name of the classes and methods to lookup "obfuscated tokens" to send over the wire (and the reverse, when processing the response from the server), so you have to keep your RF interfaces (services and proxies) names untouched, or change the class and method names –as string literals– in the generated <NameOfYourRequestFactoryInterfaceHere>DeofuscatorBuilder class to the ones generated by Proguard.

Double

unread,
Mar 1, 2012, 12:31:47 PM3/1/12
to google-we...@googlegroups.com
Thomas,

That makes sense but I'm still having trouble getting proguard to ignore them even after adding the following:

# everything in the shared directory
-keep class com.project.mms.shared.* {*;}
-keep interface com.project.mms.shared.*{*;}

# everything that could extend the request factory (even though I think this is redundant)
-keep class * extends com.google.web.bindery.requestfactory.shared.*{*;}
-keep interface * extends com.google.web.bindery.requestfactory.shared.*{*;}


When i look at my mapping.txt file I still see a lot of " webdindery... -> a" comments and I'm still getting the error. Clearly I'm not using proguard correctly, do you know what I'm doing wrong? 

Thanks,
Aaron

Double

unread,
Mar 1, 2012, 5:20:07 PM3/1/12
to google-we...@googlegroups.com

Hey Thomas,

I finally got it working

new progaurd file contents (changes only):


 
-keep class com.project.mms.C2DMReceiver {*;}
-keep interface com.project.mms.shared.ArmorTextRequest {*;}
-keep interface com.project.mms.shared.MessageProxy {*;}
-keep interface com.project.mms.shared.PublicKeyProxy {*;}
-keep interface com.project.mms.shared.RegistrationInfoProxy {*;}
-keep class com.project.mms.AndroidRequestTransport {*;}

-keep interface com.project.mms.client.** {*;}

-keep class com.google.web.bindery.** {*;}
-keep interface com.google.web.bindery.** {*;}


do any of these seem unnecessary? I've been playing around to get the minimum subset of classes that need to remain un-obfuscated.

On Thursday, March 1, 2012 4:53:32 AM UTC-5, Thomas Broyer wrote:

On Thursday, March 1, 2012 4:53:32 AM UTC-5, Thomas Broyer wrote:
On Thursday, March 1, 2012 4:53:32 AM UTC-5, Thomas Broyer wrote:
On Thursday, March 1, 2012 4:53:32 AM UTC-5, Thomas Broyer wrote:
On Thursday, March 1, 2012 4:53:32 AM UTC-5, Thomas Broyer wrote:
On Thursday, March 1, 2012 4:53:32 AM UTC-5, Thomas Broyer wrote:
On Thursday, March 1, 2012 4:53:32 AM UTC-5, Thomas Broyer wrote:
Reply all
Reply to author
Forward
0 new messages