我正在尝试将Proguard与Quickblox-2.4罐子集成。我的日志猫显示此异常:
: FATAL EXCEPTION: main
: java.lang.ClassCastException: com.d.a.b.v cannot be cast to com.quickblox.users.model.QBUserWrap
: at com.quickblox.users.model.QBUserPaged.getEntity(QBUserPaged.java:32)
: at com.quickblox.users.model.QBUserPaged.getEntity(QBUserPaged.java:13)
: at com.quickblox.core.parser.QBJsonParser.b(QBJsonParser.java:123)
: at com.quickblox.core.parser.QBJsonParser.parse(QBJsonParser.java:81)
: at com.quickblox.core.query.Query$VersionEntityCallback.completedWithResponse(Query.java:334)
: at com.quickblox.core.query.Query.completedWithResponse(Query.java:260)
: at com.quickblox.core.server.HttpRequestRunnable$1.handleMessage(HttpRequestRunnable.java:41)
: at android.os.Handler.dispatchMessage(Handler.java:99)
: at android.os.Looper.loop(Looper.java:137)
: at android.app.ActivityThread.main(ActivityThread.java:4960)
: at java.lang.reflect.Method.invokeNative(Native Method)
: at java.lang.reflect.Method.invoke(Method.java:511)
: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
: at dalvik.system.NativeStart.main(Native Method)
这是我对Quickblox的proguard配置文件内容:
#QuickBlox
-keep class org.jivesoftware.smack.** { public *; }
-keep class org.jivesoftware.smackx.** { public *; }
-keep class com.quickblox.** { public *; }
-keep class * extends org.jivesoftware.smack { public *; }
-keep class * implements org.jivesoftware.smack.debugger.SmackDebugger { public *; }
我认为可能是这段代码给出了错误,但我不确定。请帮忙!提前谢谢。
QBPagedRequestBuilder pagedRequestBuilder = new QBPagedRequestBuilder();
pagedRequestBuilder.setPage(1);
pagedRequestBuilder.setPerPage(1000);
QBUsers.getUsers(pagedRequestBuilder,
new QBEntityCallbackImpl<ArrayList<QBUser>>() {
@Override
public void onSuccess(ArrayList<QBUser> qbUsers,
Bundle bundle) {
}
@Override
public void onError(List<String> errors) {
// DialogUtils.showLong(ctx, errors.get(0));
}
});
我回复晚了,遇到了同样的问题,找到了一些proguard规则,问题现在已经解决了,愿它也会帮助某人。
QuickBlox 的 Proguard 规则:
-keep class com.quickblox.auth.parsers.** { *; }
-keep class com.quickblox.auth.model.** { *; }
-keep class com.quickblox.core.parser.** { *; }
-keep class com.quickblox.core.model.** { *; }
-keep class com.quickblox.core.server.** { *; }
-keep class com.quickblox.core.rest.** { *; }
-keep class com.quickblox.core.error.** { *; }
-keep class com.quickblox.core.Query { *; }
-keep class com.quickblox.users.parsers.** { *; }
-keep class com.quickblox.users.model.** { *; }
-keep class com.quickblox.chat.parser.** { *; }
-keep class com.quickblox.chat.model.** { *; }
-keep class com.quickblox.messages.parsers.** { *; }
-keep class com.quickblox.messages.model.** { *; }
-keep class com.quickblox.content.parsers.** { *; }
-keep class com.quickblox.content.model.** { *; }
-keep class org.jivesoftware.** { *; }
-dontwarn org.jivesoftware.smackx.**
-keep class org.jivesoftware.smack.** { public *; }
-keep class org.jivesoftware.smackx.** { *; }
-keep class com.quickblox.** { public *; }
-keep class * extends org.jivesoftware.smack { public *; }
-keep class * extends org.jivesoftware.smackx
-keep class * implements org.jivesoftware.smack.debugger.SmackDebugger { public *; }