Saurav Ghimire
Saurav Ghimire

Reputation: 568

Firebase IllegalAccessException in release apk

I have added SHA1 for both debug and release keystore in firebase project console. I have also updated by google-services.json file in app. Debug apk is working fine and accessing all realtime database of firebase but when I build release apk I get the following exception while accessing Firebase database.

07-29 08:48:04.527 20997-20997/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.entrance.nepal, PID: 20997
    java.lang.RuntimeException: java.lang.IllegalAccessException: java.lang.Class<com.tenhaff.uniingress.fragments.UserListFragment$UserViewHolder> is not accessible from java.lang.Class<com.firebase.ui.database.FirebaseRecyclerAdapter>
        at com.firebase.ui.database.FirebaseRecyclerAdapter.onCreateViewHolder(FirebaseRecyclerAdapter.java:171)
        at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5779)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5003)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4913)
        at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2029)
        at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1414)
        at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1377)
        at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:578)
        at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3260)
        at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3069)
        at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3518)

Upvotes: 1

Views: 872

Answers (2)

Saurav Ghimire
Saurav Ghimire

Reputation: 568

ViewHolder Classes should be public rather than private or protected. It was because of proguard.

Upvotes: 5

sonnv1368
sonnv1368

Reputation: 1597

Did you have the proguard-rules.pro? If you used the file, please check proguard for firebase.

Upvotes: 0

Related Questions