Epoxy version 4.5.0 does not work with paging-runtime-ktx 3.0.0
See original GitHub issueHello,
So in our app we’re using com.airbnb.android:epoxy-paging:4.5.0
, which internally depends on androidx.paging:paging-runtime:2.0.0
.
From another library module that we implements, androidx.paging:paging-runtime-ktx:3.0.0
is used.
As Gradle’s version resolution strategy, when the same library module is being used inside the app, the newer one will be selected. (https://docs.gradle.org/current/userguide/dependency_resolution.html)
Hence, we’ll finally have the source code of com.airbnb.android:epoxy-paging:4.5.0
with androidx.paging:paging-runtime-ktx:3.0.0
inside the APK.
This leads to a crash with below stack trace:
Thread: main, Exception: java.lang.IllegalStateException: Failed to hijack update handler in AsyncPagedListDiffer.You can only build models on the main thread at com.airbnb.epoxy.paging.PagedListModelCache$asyncDiffer$1.<init>(PagedListModelCache.kt:169) at com.airbnb.epoxy.paging.PagedListModelCache.<init>(PagedListModelCache.kt:149) at com.airbnb.epoxy.paging.PagedListModelCache.<init>(PagedListModelCache.kt:55) at com.airbnb.epoxy.paging.PagedListEpoxyController.<init>(PagedListEpoxyController.kt:62) at com.airbnb.epoxy.paging.PagedListEpoxyController.<init>(PagedListEpoxyController.kt:59) at im.vector.app.features.home.room.list.RoomSummaryPagedController.<init>(RoomSummaryPagedController.kt:27) at im.vector.app.features.home.room.list.RoomSummaryPagedControllerFactory.createRoomSummaryPagedController(RoomSummaryPagedControllerFactory.kt:26) at im.vector.app.features.home.room.list.RoomListFragment.setupRecyclerView(RoomListFragment.kt:250) at im.vector.app.features.home.room.list.RoomListFragment.onViewCreated(RoomListFragment.kt:107) at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7660) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) Caused by: java.lang.NoSuchFieldException: No field mMainThreadExecutor in class Landroidx/paging/AsyncPagedListDiffer; (declaration of ‘androidx.paging.AsyncPagedListDiffer’ appears in /data/app/~~DH_CG1GATPrzhWIhETVmRQ==/im.vector.app.debug-TwcZ317FHCs1gBBbiJLzOA==/base.apk) at java.lang.Class.getDeclaredField(Native Method) at com.airbnb.epoxy.paging.PagedListModelCache$asyncDiffer$1.<init>(PagedListModelCache.kt:157) at com.airbnb.epoxy.paging.PagedListModelCache.<init>(PagedListModelCache.kt:149) at com.airbnb.epoxy.paging.PagedListModelCache.<init>(PagedListModelCache.kt:55) at com.airbnb.epoxy.paging.PagedListEpoxyController.<init>(PagedListEpoxyController.kt:62) at com.airbnb.epoxy.paging.PagedListEpoxyController.<init>(PagedListEpoxyController.kt:59) at im.vector.app.features.home.room.list.RoomSummaryPagedController.<init>(RoomSummaryPagedController.kt:27) at im.vector.app.features.home.room.list.RoomSummaryPagedControllerFactory.createRoomSummaryPagedController(RoomSummaryPagedControllerFactory.kt:26) at im.vector.app.features.home.room.list.RoomListFragment.setupRecyclerView(RoomListFragment.kt:250) at im.vector.app.features.home.room.list.RoomListFragment.onViewCreated(RoomListFragment.kt:107) at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:524) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7660) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
The reason is: Class PagedListModelCache
inside paging-runtime
’s implementation relies on this field: mMainThreadExecutor
, which is gotten from AsyncPagedListDiffer
, via reflection.

However, from androidx.paging:paging-runtime-ktx:3.0.0
, the field was renamed to mainThreadExecutor
, which then breaks this logic of PagedListModelCache
.
So my question is: Are you planing to update your epoxy-paging
module to make it work with newer version of paging-runtime
from Google?
If you are not doing it in a very near future, what would you suggest us doing to solve this issue?
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
@elihart
PagedDataEpoxyController
andPagedDataModelCache
already exist inepoxy-paging3
module. I believePagedListEpoxyController
andPagedListModelCache
are here for large application developers when they migrate from paging2 to paging3 because they don’t have to change everything at once. I’ve just started migration and found this issue, so I’ve sent #1263.I see, yes it seems like what you’re saying is right. Also in general AsyncPagedListDiffer and PagedList in the paging3 module are now deprecated and need to be replaced so the whole module needs an update.
I won’t be able to do that work myself (paging is all community contributed) so if anyone wants this fixed please contribute the change with tests.