android - Proguard and HashMap<String, MyObject> -
i'm developing apis android library project , i'd export them obfuscated jar.
i have various classes public entities are:
myinterface
: interface listing methods user have implement;myutilities
: class static methods;mysingleton
: singleton (implemented enum single instance);myobject
: class implementing particular object need handle;
i new obfuscation followed tutorials , read android/proguard docs.
i created jar project , used in external application. obfuscated non-public classes (so every class apart above-mentioned) , still continue working.
now problem:
one of methods specifed in myinterface
is
public void getobject(hashmap<string, myobject>);
before obfuscation user add implements myinterface
activity/class , (auto) generate implementation of the interface methods, in particular:
@override public void getobject(hashmap<string, myobject> hashmap){ // user implementation }
after having obfuscated jar, when add implements myinterface
user activity , auto-generate methods implementations, get:
@override public void getobject(hashmap hashmap){ // user implementation }
so without hashmap types. don't know why happens.. expected see hashmap types because both string
, myobject
kept.
it still works without hashmap types, have cast hasmap<string, myobject>
this proguard conf file (generated proguard gui tool):
-injars inapis.jar -outjars 'obfapis.jar' -libraryjars /my/android/sdk/path/platforms/android-15/android.jar -libraryjars /my/android/sdk/path/tools/support/annotations.jar -libraryjars /my/android/sdk/path/add-ons/addon-google_apis-google-15/libs/effects.jar -libraryjars /my/android/sdk/path/add-ons/addon-google_apis-google-15/libs/maps.jar -libraryjars /my/android/sdk/path/add-ons/addon-google_apis-google-15/libs/usb.jar -overloadaggressively -keep class my.package.myobject { public <fields>; public <methods>; } -keep public class my.package.myutilities { public <fields>; public <methods>; } -keep interface my.package.myinteface { public <fields>; public <methods>; } -keep public class my.package.mysingleton { public <fields>; public <methods>; } -keep,allowshrinking public class my.package.myinterface { public <fields>; public <methods>; } -keep,allowshrinking public class my.package.myobject -keep,allowshrinking public class my.package.myutils -keep,allowshrinking public enum my.package.mysingleton { public <fields>; public <methods>; }
according proguard docs, may want add following option:
-keepattributes signature
quoting docs:
the "signature" attribute required able access generic types when compiling in jdk 5.0 , higher.
Comments
Post a Comment