java - Method in inner class stripped away by proguard -
i'm working on android project, in i'm doing calculation in c, using android ndk.
my application works fine long not run proguard, when do, method "reportprogress", stripped away proguard. method part of private inner class extends asynctask
private class calculatetask extends asynctask
i call native code reference calculatetask instance. native code call member in class, using following code in jni
jclass taskclass = (*env)->getobjectclass(env, task); jmethodid reportprogressmid = (*env)->getmethodid(env, taskclass, "reportprogress", "(ljava/lang/string;i)z");
where task reference instance of calculatetask. i'm having hard time telling proguard not strip away
public boolean reportprogress(string, int)
method, called via jni.
until have taken following approaches, none of did trick:
keeping entire class:
-keep class mypackagename.calculatescreen$calculatetask
only keeping mentioned method, doing:
-keep class mypackagename.calculatescreen$calculatetask { public boolean reportprogress(java.lang.string,int); }
or this:
-keepclassmembers class mypackagename.calculatescreen$calculatetask { public boolean reportprogress(java.lang.string,int); }
using annotations (reusing google admob annotation):
-keep class mypackagename.calculatescreen$calculatetask { @com.google.android.gms.common.annotation.keepname <methods>; }
or this:
-keepclassmembers class mypackagename.calculatescreen$calculatetask { @com.google.android.gms.common.annotation.keepname <methods>; }
my proguard configuration based on "optimize" distributed android sdk, named proguard-android-optimize.txt.
please note proguard run via gradle, , have made sure proguard task cleaned , rerun.
your second , third configuration should work case:
-keepclassmembers class mypackagename.calculatescreen$calculatetask { public boolean reportprogress(java.lang.string,int); }
you should check class name , method name typos. should check if method public.
you can verify if method preserved in bin/proguard/seeds.txt
.
you can check compiled input class , processed output class javap
.
Comments
Post a Comment