Exception from array serialization with proguard android

I used the snappy DB library and the 'Location' class has a default constructor.
works great when not using proguard, but when using proguard:

This is my exception:

java.lang.IllegalArgumentException: Unable to create serializer "com.d.a.c.x" for class: Object[]

      

This is my code:

import com.snappydb.DBFactory;
ArrayList<Location> mLocationsList;
snappydb = DBFactory.open(mContext, "LocationsList");
snappydb.put("LocationsList", mLocationsList.toArray());

      

Throws an exception on this line:

snappydb.put("LocationsList", locationsList.toArray());

      


I have tried -keep class mypackagename.Location { *; }

in the proguard of the project and my "Location" class implements Serilizable.

Still not working...

+3


source to share


1 answer


Flag

-dontshrink

seems to solve the problem.

Here's the complete proguard configuration for SnappyDB

and Kryo

:



    -dontshrink
    -verbose
    -dontwarn sun.reflect.**
    -dontwarn java.beans.**
    -keep,allowshrinking class com.esotericsoftware.** {
       <fields>;
       <methods>;
    }
    -keep,allowshrinking class java.beans.** { *; }
    -keep,allowshrinking class sun.reflect.** { *; }
    -keep,allowshrinking class com.esotericsoftware.kryo.** { *; }
    -keep,allowshrinking class com.esotericsoftware.kryo.io.** { *; }
    -keep,allowshrinking class sun.nio.ch.** { *; }
    -dontwarn sun.nio.ch.**
    -dontwarn sun.misc.**

    -keep,allowshrinking class com.snappydb.** { *; }
    -dontwarn com.snappydb.**

      

+6


source







All Articles