Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after proguard added #122

Closed
mehdi-salehi opened this issue Jan 1, 2018 · 5 comments
Closed

after proguard added #122

mehdi-salehi opened this issue Jan 1, 2018 · 5 comments

Comments

@mehdi-salehi
Copy link

E/UncaughtException: java.lang.UnsupportedOperationException: Somehow we couldn't create the ViewHolder for message. Please, report this issue on GitHub with full stacktrace in description.
at com.....chat.MessageHolders.getHolder(SourceFile:413)
at com......chat.MessageHolders.getHolder(SourceFile:396)
at com......chat.MessageHolders.getHolder(SourceFile:329)
at com......chat.MessagesListAdapter.onCreateViewHolder(SourceFile:83)
at com......chat.MessagesListAdapter.onCreateViewHolder(SourceFile:31)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(SourceFile:6488)
at android.support.v7.widget.RecyclerView$Recycler.a(SourceFile:5675)
at android.support.v7.widget.RecyclerView$Recycler.a(SourceFile:5558)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(SourceFile:5554)
at android.support.v7.widget.LinearLayoutManager$b.a(SourceFile:2229)
at android.support.v7.widget.LinearLayoutManager.a(SourceFile:1556)
at android.support.v7.widget.LinearLayoutManager.a(SourceFile:1516)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(SourceFile:583)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(SourceFile:3694)
at android.support.v7.widget.RecyclerView.o(SourceFile:3411)
at android.support.v7.widget.RecyclerView.onLayout(SourceFile:3963)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at com.android.internal.policy.DecorView.onLayout(DecorView.java:818)
at android.view.View.layout(View.java:18793)
at android.view.ViewGroup.layout(ViewGroup.java:5952)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2625)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2341)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1493)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7040)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:638)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6688)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
E/UncaughtException: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: java.lang.NoSuchMethodException: [class android.view.View]
at java.lang.Class.getConstructor0(Class.java:2204)
at java.lang.Class.getDeclaredConstructor(Class.java:2050)
at com.saamtaxi.app_client.chat.MessageHolders.getHolder(SourceFile:404)
... 58 more

@andriizhumela
Copy link
Contributor

@mehdi-salehi Can you show the part of the code that caused this error?

@pedrofsn
Copy link

pedrofsn commented Aug 9, 2018

Process: com.abcdef_name_my_app, PID: 26212
    java.lang.UnsupportedOperationException: Somehow we couldn't create the ViewHolder for message. Please, report this issue on GitHub with full stacktrace in description.
        at com.stfalcon.chatkit.messages.b.a(:415)
        at com.stfalcon.chatkit.messages.b.a(:399)
        at com.stfalcon.chatkit.messages.b.a(:332)
        at com.stfalcon.chatkit.messages.g.onCreateViewHolder(:99)
        at com.stfalcon.chatkit.messages.g.onCreateViewHolder(:47)
        at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(:6685)
        at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(:5869)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(:5752)
        at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(:5748)
        at android.support.v7.widget.LinearLayoutManager$b.a(:2232)
        at android.support.v7.widget.LinearLayoutManager.layoutChunk(:1559)
        at android.support.v7.widget.LinearLayoutManager.fill(:1519)
        at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(:589)
        at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(:3812)
        at android.support.v7.widget.RecyclerView.dispatchLayout(:3529)
        at android.support.v7.widget.RecyclerView.onLayout(:4082)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.support.v7.widget.ActionBarOverlayLayout.onLayout(:443)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
        at com.android.internal.policy.DecorView.onLayout(DecorView.java:769)
        at android.view.View.layout(View.java:19613)
        at android.view.ViewGroup.layout(ViewGroup.java:6053)
        at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2496)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2212)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1394)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6786)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
        at android.view.Choreographer.doCallbacks(Choreographer.java:778)
        at android.view.Choreographer.doFrame(Choreographer.java:713)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
2018-08-09 11:47:44.670 26212-26212/? E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:169)
        at android.app.ActivityThread.main(ActivityThread.java:6595)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
     Caused by: java.lang.InstantiationException: Can't instantiate abstract class com.stfalcon.chatkit.messages.b$k
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
        at com.stfalcon.chatkit.messages.b.a(:409)
        	... 65 more

@pedrofsn
Copy link

pedrofsn commented Aug 9, 2018

[FIX]

I'm keeping everything in my proguard.txt. It's not a good solution but you can run the application. I suggest improve this for we can optimize apk size!

-keep class com.stfalcon.chatkit.** { *; }

@mehdi-salehi

@bevzaanton
Copy link
Contributor

Hi! For working with Proguard you need to add this rules:

-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$OutcomingTextMessageViewHolder {
     public <init>(android.view.View, java.lang.Object);
     public <init>(android.view.View);
 }
-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$IncomingTextMessageViewHolder {
     public <init>(android.view.View, java.lang.Object);
     public <init>(android.view.View);
 }
-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$IncomingImageMessageViewHolder {
     public <init>(android.view.View, java.lang.Object);
     public <init>(android.view.View);
 }
-keep class * extends com.stfalcon.chatkit.messages.MessageHolders$OutcomingImageMessageViewHolder {
     public <init>(android.view.View, java.lang.Object);
     public <init>(android.view.View);
 }

Also I added this to Readme. https://github.com/stfalcon-studio/ChatKit#proguard

@dennishylau
Copy link

This issue should be reopen, as detailed here: #210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants