0

I have a bunch of Recycler views in my app that gets data from the firestore database. Everything went fine in my debug app but when I added minifyEnabled true In my proguard everything worked fine but the activity hosts recycler fails with the below logcat error. I'm totally unaware of how to add the proguard rules for the model classes

I just made my stacktrace and this is the error

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.swf.sahrudhayafoundation, PID: 30519
    java.lang.RuntimeException: No properties to serialize found on class com.swf.sahrudhayafoundation.q.b
        at com.google.firebase.firestore.o0.l$a.<init>(:714)
        at com.google.firebase.firestore.o0.l.z(:377)
        at com.google.firebase.firestore.o0.l.e(:540)
        at com.google.firebase.firestore.o0.l.s(:253)
        at com.google.firebase.firestore.o0.l.p(:100)
        at com.google.firebase.firestore.i.o(:187)
        at com.google.firebase.firestore.z.o(:116)
        at com.google.firebase.firestore.i.n(:165)
        at com.google.firebase.firestore.z.n(:97)
        at com.firebase.ui.firestore.b.b(:23)
        at com.firebase.ui.firestore.b.a(:12)
        at c.a.a.a.a.a(:36)
        at c.a.a.a.c.get(:52)
        at com.firebase.ui.firestore.FirestoreRecyclerAdapter.I(:86)
        at com.firebase.ui.firestore.FirestoreRecyclerAdapter.x(:158)
        at androidx.recyclerview.widget.RecyclerView$g.y(:7065)
        at androidx.recyclerview.widget.RecyclerView$g.k(:7107)
        at androidx.recyclerview.widget.RecyclerView$v.H(:6012)
        at androidx.recyclerview.widget.RecyclerView$v.I(:6279)
        at androidx.recyclerview.widget.RecyclerView$v.p(:6118)
        at androidx.recyclerview.widget.RecyclerView$v.o(:6114)
        at androidx.recyclerview.widget.LinearLayoutManager$c.d(:2303)
        at androidx.recyclerview.widget.LinearLayoutManager.s2(:1627)
        at androidx.recyclerview.widget.LinearLayoutManager.U1(:1587)
        at androidx.recyclerview.widget.LinearLayoutManager.X0(:665)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(:4134)
        at androidx.recyclerview.widget.RecyclerView.onMeasure(:3540)
        at android.view.View.measure(View.java:24817)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6934)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
        at android.view.View.measure(View.java:24817)
        at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1455)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
        at android.widget.ScrollView.onMeasure(ScrollView.java:475)
        at android.view.View.measure(View.java:24817)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6934)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
        at androidx.appcompat.widget.ContentFrameLayout.onMeasure(:143)
        at android.view.View.measure(View.java:24817)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6934)
        at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(:403)
        at android.view.View.measure(View.java:24817)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6934)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
        at android.view.View.measure(View.java:24817)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6934)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
        at android.view.View.measure(View.java:24817)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6934)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
        at com.android.internal.policy.DecorView.onMeasure(DecorView.java:795)
        at android.view.View.measure(View.java:24817)
        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3361)
        at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2121)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2415)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2005)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8204)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1085)
        at android.view.Choreographer.doCallbacks(Choreographer.java:908)
        at android.view.Choreographer.doFrame(Choreographer.java:835)
E/AndroidRuntime:     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1070)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:228)
        at android.app.ActivityThread.main(ActivityThread.java:7782)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:981)
  • You should always provide enough information to enable others to answer your question, like error stack trace and code in this case. – EraftYps Jun 15 '20 at 14:24
  • @EraftYps Please check the updated description in my question. – CodeRED Innovations Jun 15 '20 at 14:41
  • Please edit your question and add your database structure as a screenshot and the content of your model class. Please respond with @AlexMamo – Alex Mamo Jun 15 '20 at 14:47
  • @AlexMamo - you're the guy I'm waiting for. To let you know the answer provided by Bimal Kafle worked I removed changed minifyEnabled to false and it works well now but when I add the same line to true it starts crashing throwing the above logcat posted. I wonder why this happens as minifyEnabled helps to reduce the app size right. I wish you'll clearly explain me in this regard. – CodeRED Innovations Jun 15 '20 at 14:51
  • 2
    @CodeREDInnovations Good to hear that Bimal Kafle's answer worked. In that case, I think you should take a look at my answer from the following **[post](https://stackoverflow.com/questions/60719791/firebase-firestore-variable-name-changed/60719948#60719948)**. – Alex Mamo Jun 15 '20 at 14:56
  • @AlexMamo - I'm a little confused about the following line can you please help me clarify what should I replace in the following line of code `-keepclassmembers com.example.YourModalClass.** { *; }`. – CodeRED Innovations Jun 15 '20 at 18:11

2 Answers2

1

May be you have problem because of proguard, to be sure just try by disabling minify in your release build type

buildTypes {
    release {
        minifyEnabled false
        ------
      }
    }
1

Add below code in your proguard rule

-keep class package.to.yourmodels.** { *; }
-keepattributes *Annotation*
-keepattributes Signature
-dontwarn com.squareup.okhttp.*
-dontwarn rx.**
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Exceptions
-keepattributes RuntimeVisibleAnnotations
-keepattributes RuntimeInvisibleAnnotations
-keepattributes RuntimeVisibleParameterAnnotations
-keepattributes RuntimeInvisibleParameterAnnotations
Vishal Sojitra
  • 486
  • 3
  • 10