0

I am using dexguard for obfuscation.I have implemented google contacts sync in my project.when i call the contact service class,this error is coming.i dint find the right solution for the error.i have gone through the mapping file also but i dint get any solution in mapping file. I have used many options like keep class and keepclassmembers.but still i get the same issue.

ContactsService  contactsService = new ContactsService("MYAPPLICATION_NAME");

I got the erro when i call the above class.this is google contact service class.

below is the error log.

java.lang.IllegalArgumentException: Class class o.ڹ doesn't support metadata registration.
at o.ԁ.ˊ(:153)
at o.ԁ.ˊ(:121)
at o.ԁ.ˊ(:384)
at o.Ϋ.ˊ(:533)
at o.Ϋ.ˋ(:455)
at o.Ϋ.ˊ(:42)
at o.গ.ˋ(:144)
at o.ܪ.ˊ(:130)
at o.ᓷ.<init>(:536)
at o.ᓶ.<init>(:201)
at o.ᓶ.<init>(:174)
at o.ᓼ.<init>(:89)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.buzzboard.contacts.fragment.AddEditContactFragment.initContactsService(:1020)
at com.buzzboard.contacts.fragment.AddEditContactFragment.onCreateView(:244)
at android.support.v4.app.Fragment.performCreateView(:1786)
at android.support.v4.app.FragmentManagerImpl.moveToState(:947)
at  android.support.v4.app.FragmentManagerImpl.moveToState(:1126)
at android.support.v4.app.BackStackRecord.run(:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(:1489)
at     android.support.v4.app.FragmentManagerImpl$1.run(:454)
at    android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5021)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:827)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:643)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoSuchMethodException: registerMetadata [class o.ԁ]
at java.lang.Class.getConstructorOrMethod(Class.java:472)
at java.lang.Class.getDeclaredMethod(Class.java:640)
at o.ԁ.ˊ(:139)

please help me.i have keep the some of google contact services classes also.

Maveňツ
  • 1
  • 12
  • 50
  • 89
RamBabu Pudari
  • 912
  • 7
  • 19

1 Answers1

2

Looking at the source code and the documentation of com.google.gdata.model.MetadataRegistry, it seems some classes are expected to contain a static method 'registerMetadata', which is then accessed through reflection. Similarly, com.google.gdata.model.Element seems to expect a field 'KEY'. Since ProGuard or DexGuard can't know this, you need to preserve such fields and methods with their original names:

-keepclassmembers class * extends com.google.gdata.model.Element {
    public static com.google.gdata.model.ElementKey KEY;
    public static void registerMetadata(com.google.gdata.model.MetadataRegistry);
}
Eric Lafortune
  • 45,150
  • 8
  • 114
  • 106
  • thank you for your answer.your answer is acceptable.i did this. – RamBabu Pudari Apr 07 '15 at 12:41
  • sorry to catch you here @Eric , but can I have your opinion on this post? [link](http://stackoverflow.com/questions/31230719/parse-com-not-working-after-proguard/31242150) – Muhammad Naderi Jul 07 '15 at 04:39
  • hi, i would like to get your attention to this question, http://stackoverflow.com/questions/35539960/how-to-get-release-build-apk-file-using-proguard, your help would be greatly appreciated – Pankaj Nimgade Feb 22 '16 at 04:04