Firebase ArrayList问题(需要使用GenericTypeIndicator吗?)

时间:2016-09-15 01:29:12

标签: android arraylist firebase firebase-realtime-database

通过USB将我的应用程序安装到手机上时,连接到我的Firebase数据库工作正常。但是当我通过Play商店安装它时,我从Firebase获得有关我的ArrayList具有“泛型类型参数”的问题。查看下面logcat错误消息的第一行:

09-14 15:59:55.715 4843-4843/? E/UncaughtException: com.google.firebase.database.f: Class java.util.ArrayList has generic type parameters, please use GenericTypeIndicator instead
                                                    at com.google.android.gms.c.mu.b(Unknown Source)
                                                    at com.google.android.gms.c.mu.b(Unknown Source)
                                                    at com.google.android.gms.c.mu.a(Unknown Source)
                                                    at com.google.android.gms.c.mv.a(Unknown Source)
                                                    at com.google.android.gms.c.mv.a(Unknown Source)
                                                    at com.google.android.gms.c.mu.d(Unknown Source)
                                                    at com.google.android.gms.c.mu.b(Unknown Source)
                                                    at com.google.android.gms.c.mu.a(Unknown Source)
                                                    at com.google.firebase.database.b.a(Unknown Source)
                                                    at com.test.finalapp.Activities.c.a(Unknown Source)
                                                    at com.google.android.gms.c.ha.a(Unknown Source)
                                                    at com.google.android.gms.c.iv.b(Unknown Source)
                                                    at com.google.android.gms.c.jb.run(Unknown Source)
                                                    at android.os.Handler.handleCallback(Handler.java:739)
                                                    at android.os.Handler.dispatchMessage(Handler.java:95)
                                                    at android.os.Looper.loop(Looper.java:152)
                                                    at android.app.ActivityThread.main(ActivityThread.java:5507)
                                                    at java.lang.reflect.Method.invoke(Native Method)
                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

有什么想法? Google Play版本前几天工作正常,现在发生了!无法在线找到任何解决方案......

更新

我将以下代码添加到我的proguard-rules.pro文件中:

   -keepattributes Signature

   -keepclassmembers class com.test.finalapp.Models.** {
      *;
    }

   -keep class com.test.finalapp.CoOpStatusHolder { *; }

数据库中的东西运行正常,但现在我遇到了错误:java.lang.RuntimeException:java.lang.NoSuchMethodException:[class android.view.View]

该错误位于较大的logcat错误的顶部:

 09-15 12:06:23.041 32250-32250/? E/UncaughtException: java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]
                                                          at com.firebase.ui.a.d.b(Unknown Source)
                                                          at android.support.v7.widget.em.c(Unknown Source)
                                                          at android.support.v7.widget.fe.a(Unknown Source)
                                                          at android.support.v7.widget.fe.c(Unknown Source)
                                                          at android.support.v7.widget.dl.a(Unknown Source)
                                                          at android.support.v7.widget.LinearLayoutManager.a(Unknown Source)
                                                          at android.support.v7.widget.LinearLayoutManager.a(Unknown Source)
                                                          at android.support.v7.widget.LinearLayoutManager.c(Unknown Source)
                                                          at android.support.v7.widget.RecyclerView.J(Unknown Source)
                                                          at android.support.v7.widget.RecyclerView.k(Unknown Source)
                                                          at android.support.v7.widget.RecyclerView.t(Unknown Source)
                                                          at android.support.v7.widget.RecyclerView.c(Unknown Source)
                                                          at android.support.v7.widget.eg.run(Unknown Source)
                                                          at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                          at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                          at android.view.Choreographer.doFrame(Choreographer.java:603)
                                                          at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                          at android.os.Handler.handleCallback(Handler.java:739)
                                                          at android.os.Handler.dispatchMessage(Handler.java:95)
                                                          at android.os.Looper.loop(Looper.java:152)
                                                          at android.app.ActivityThread.main(ActivityThread.java:5507)
                                                          at java.lang.reflect.Method.invoke(Native Method)
                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                       Caused by: java.lang.NoSuchMethodException: <init> [class android.view.View]
                                                          at java.lang.Class.getConstructor(Class.java:528)
                                                          at java.lang.Class.getConstructor(Class.java:492)
                                                          at com.firebase.ui.a.d.b(Unknown Source) 
                                                          at android.support.v7.widget.em.c(Unknown Source) 
                                                          at android.support.v7.widget.fe.a(Unknown Source) 
                                                          at android.support.v7.widget.fe.c(Unknown Source) 
                                                          at android.support.v7.widget.dl.a(Unknown Source) 
                                                          at android.support.v7.widget.LinearLayoutManager.a(Unknown Source) 
                                                          at android.support.v7.widget.LinearLayoutManager.a(Unknown Source) 
                                                          at android.support.v7.widget.LinearLayoutManager.c(Unknown Source) 
                                                          at android.support.v7.widget.RecyclerView.J(Unknown Source) 
                                                          at android.support.v7.widget.RecyclerView.k(Unknown Source) 
                                                          at android.support.v7.widget.RecyclerView.t(Unknown Source) 
                                                          at android.support.v7.widget.RecyclerView.c(Unknown Source) 
                                                          at android.support.v7.widget.eg.run(Unknown Source) 
                                                          at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858) 
                                                          at android.view.Choreographer.doCallbacks(Choreographer.java:670) 
                                                          at android.view.Choreographer.doFrame(Choreographer.java:603) 
                                                          at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) 
                                                          at android.os.Handler.handleCallback(Handler.java:739) 
                                                          at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                          at android.os.Looper.loop(Looper.java:152) 
                                                          at android.app.ActivityThread.main(ActivityThread.java:5507) 
                                                          at java.lang.reflect.Method.invoke(Native Method) 
                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
09-15 12:06:23.242 32250-32250/? D/FirebaseCrashApiImpl: throwable java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]

                                                         --------- beginning of crash
09-15 12:06:23.278 32250-32250/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                   Process: com.test.finalapp, PID: 32250
                                                   java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]
                                                       at com.firebase.ui.a.d.b(Unknown Source)
                                                       at android.support.v7.widget.em.c(Unknown Source)
                                                       at android.support.v7.widget.fe.a(Unknown Source)
                                                       at android.support.v7.widget.fe.c(Unknown Source)
                                                       at android.support.v7.widget.dl.a(Unknown Source)
                                                       at android.support.v7.widget.LinearLayoutManager.a(Unknown Source)
                                                       at android.support.v7.widget.LinearLayoutManager.a(Unknown Source)
                                                       at android.support.v7.widget.LinearLayoutManager.c(Unknown Source)
                                                       at android.support.v7.widget.RecyclerView.J(Unknown Source)
                                                       at android.support.v7.widget.RecyclerView.k(Unknown Source)
                                                       at android.support.v7.widget.RecyclerView.t(Unknown Source)
                                                       at android.support.v7.widget.RecyclerView.c(Unknown Source)
                                                       at android.support.v7.widget.eg.run(Unknown Source)
                                                       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                       at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                       at android.view.Choreographer.doFrame(Choreographer.java:603)
                                                       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                       at android.os.Handler.handleCallback(Handler.java:739)
                                                       at android.os.Handler.dispatchMessage(Handler.java:95)
                                                       at android.os.Looper.loop(Looper.java:152)
                                                       at android.app.ActivityThread.main(ActivityThread.java:5507)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                                                    Caused by: java.lang.NoSuchMethodException: <init> [class android.view.View]
                                                       at java.lang.Class.getConstructor(Class.java:528)
                                                       at java.lang.Class.getConstructor(Class.java:492)
                                                       at com.firebase.ui.a.d.b(Unknown Source) 
                                                       at android.support.v7.widget.em.c(Unknown Source) 
                                                       at android.support.v7.widget.fe.a(Unknown Source) 
                                                       at android.support.v7.widget.fe.c(Unknown Source) 
                                                       at android.support.v7.widget.dl.a(Unknown Source) 
                                                       at android.support.v7.widget.LinearLayoutManager.a(Unknown Source) 
                                                       at android.support.v7.widget.LinearLayoutManager.a(Unknown Source) 
                                                       at android.support.v7.widget.LinearLayoutManager.c(Unknown Source) 
                                                       at android.support.v7.widget.RecyclerView.J(Unknown Source) 
                                                       at android.support.v7.widget.RecyclerView.k(Unknown Source) 
                                                       at android.support.v7.widget.RecyclerView.t(Unknown Source) 
                                                       at android.support.v7.widget.RecyclerView.c(Unknown Source) 
                                                       at android.support.v7.widget.eg.run(Unknown Source) 
                                                       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858) 
                                                       at android.view.Choreographer.doCallbacks(Choreographer.java:670) 
                                                       at android.view.Choreographer.doFrame(Choreographer.java:603) 
                                                       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) 
                                                       at android.os.Handler.handleCallback(Handler.java:739) 
                                                       at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                       at android.os.Looper.loop(Looper.java:152) 
                                                       at android.app.ActivityThread.main(ActivityThread.java:5507) 
                                                       at java.lang.reflect.Method.invoke(Native Method) 
                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

CoOpStatusHolder是我的FirebaseUI RecyclerView Viewholder。我让Viewholder成为一个内部类。我把它公之于静,它在proguard-rules.pro文件中,所以我仍然不确定问题是什么......

public static class CoOpStatusHolder extends RecyclerView.ViewHolder {
    View mView;


    public CoOpStatusHolder(View itemView) {
        super(itemView);
        mView = itemView;
    }

    public void setName(String name) {
        TextView nameOfParentToChoose = (TextView) mView.findViewById(R.id.
                textView_of_parent_name_in_co_op_status);
        nameOfParentToChoose.setText(name);
    }

    public void setFacebookImage(String facebookID) {
        ProfilePictureView parentFacebookPhoto = (ProfilePictureView) mView.findViewById(R.id.
                imageview_of_parent_in_co_op_status);
        parentFacebookPhoto.setProfileId(facebookID);
    }

    public void setHours(Float numofHours) {
        TextView numOfHoursForParent = (TextView) mView.findViewById(R.id.
                textView_num_of_hours_in_co_op_other_parent_status);
        numOfHoursForParent.setText(Float.toString(numofHours));
    }


}

0 个答案:

没有答案