我有一个简单的类扩展ResultReceiver,用于在服务和某些活动之间进行通信:
NSPredicate *predicate = [NSPredicate predicateWithFormat:
@"ANY region.beacons.minor = nil"];
它非常好用如果不使用带有minifyEnabled true的proguard 但如果我使用它,我会在发布后稍微崩溃:
android.os.BadParcelableException:Parcelable协议需要一个 Parcelable.Creator对象在类上称为CREATOR DataSyncResultReceiver
我尝试了以下proguard规则,没有成功:
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.os.ResultReceiver;
@SuppressLint("ParcelCreator")
public class DataSyncResultReceiver extends ResultReceiver {
private Receiver mReceiver;
public DataSyncResultReceiver(Receiver receiver, Handler handler) {
super(handler);
setReceiver(receiver);
}
public interface Receiver {
void onReceiveResult(int resultCode, Bundle resultData);
}
public void setReceiver(Receiver receiver) {
mReceiver = receiver;
}
public boolean hasReceiver() {
return mReceiver != null;
}
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (mReceiver == null) {
Log.e("DataSyncResultReceiver", "Receiver is null");
} else {
mReceiver.onReceiveResult(resultCode, resultData);
}
}
}
有人可以帮我解决这个问题吗?
答案 0 :(得分:1)
通过添加
修复-keep public class * extends android.support.v4.os.ResultReceiver