sangcomz / FishBun

:blowfish:FishBun is Image Picker for android.
Apache License 2.0
671 stars 144 forks source link

[BUG] #255

Closed konstantin1883 closed 2 years ago

konstantin1883 commented 2 years ago

The application is crash if you set the CoilAdapter() as an image adapter "FishBun.with(this).setImageAdapter(CoilAdapter())", if you set the Glide GlideAdapter(), then everything works.

java.lang.NoClassDefFoundError: Failed resolution of: Lcoil/request/LoadRequest; at com.sangcomz.fishbun.adapter.image.impl.CoilAdapter.loadImage(CoilAdapter.kt:36) at com.sangcomz.fishbun.ui.album.adapter.AlbumListAdapter$ViewHolder.setData(AlbumListAdapter.kt:87) at com.sangcomz.fishbun.ui.album.adapter.AlbumListAdapter.onBindViewHolder(AlbumListAdapter.kt:48) at com.sangcomz.fishbun.ui.album.adapter.AlbumListAdapter.onBindViewHolder(AlbumListAdapter.kt:17) at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7254) at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7337) at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6194) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6460) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6300) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6296) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2330) at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:572) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:668) at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4309) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4012) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4578) at android.view.View.layout(View.java:24461) at android.view.ViewGroup.layout(ViewGroup.java:7412) at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1873) at android.view.View.layout(View.java:24461) at android.view.ViewGroup.layout(ViewGroup.java:7412) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:374) at android.widget.FrameLayout.onLayout(FrameLayout.java:312) at android.view.View.layout(View.java:24461) at android.view.ViewGroup.layout(ViewGroup.java:7412) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:24461) at android.view.ViewGroup.layout(ViewGroup.java:7412) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:374) at android.widget.FrameLayout.onLayout(FrameLayout.java:312) at android.view.View.layout(View.java:24461) at android.view.ViewGroup.layout(ViewGroup.java:7412) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:24461) at android.view.ViewGroup.layout(ViewGroup.java:7412) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:374) at android.widget.FrameLayout.onLayout(FrameLayout.java:312) at com.android.internal.policy.DecorView.onLayout(DecorView.java:1331) at android.view.View.layout(View.java:24461) at android.view.ViewGroup.layout(ViewGroup.java:7412) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:4614) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4036) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2924) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10513) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1108) at android.view.Choreographer.doCallbacks(Choreographer.java:866) 2022-11-08 17:37:48.402 E at android.view.Choreographer.doFrame(Choreographer.java:797) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8751) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) Caused by: java.lang.ClassNotFoundException: Didn't find class "coil.request.LoadRequest" on path: DexPathList[[dex file "/data/data//code_cache/.overlay/base.apk/classes16.dex", zip file "/data/app/2xS1HlXDSIVrcSybqY330Q==/-2tEfUsezNlWEBXh9J2JUcg==/base.apk"],nativeLibraryDirectories=[/data/app/2xS1HlXDSIVrcSybqY330Q==-2tEfUsezNlWEBXh9J2JUcg==/lib/arm64, /data/app/~~2xS1HlXDSIVrcSybqY330Q==/-2tEfUsezNlWEBXh9J2JUcg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312)

dependencies implementation "io.coil-kt:coil:2.2.2" implementation 'com.github.bumptech.glide:glide:4.12.0' implementation 'io.github.sangcomz:fishbun:1.1.0'

Samsung S 21 ultra

sangcomz commented 2 years ago

The issue seems to be caused by the version of the Coil dependency. I think it would be better to use the method by making an adpater yourself and using it first. Thank you for your report.

konstantin1883 commented 2 years ago

Thanks for your response, I'm waiting for a solution to the bug, since I have a problem that I can not remove Glide from the project.

sangcomz commented 2 years ago

oh, you can fix this issue, right now. You just need to implement your own imageAdapter.

implement ImageAdapter

class CustomImageAdapter : ImageAdapter {
    override fun loadDetailImage(target: ImageView, loadUrl: Uri) {
        //use your image load libray
    }

    override fun loadImage(target: ImageView, loadUrl: Uri) {
        //use your image load library
    }
}

use like this

FishBun.with(this).setImageAdapter(CustomFImageAdapter())

Please try and let me know if it doesn't work.

konstantin1883 commented 2 years ago

worked, thanks