question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Epoxy version 4.5.0 does not work with paging-runtime-ktx 3.0.0

See original GitHub issue

Hello,

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.

Screen Shot 2021-06-23 at 00 07 20

However, from androidx.paging:paging-runtime-ktx:3.0.0, the field was renamed to mainThreadExecutor, which then breaks this logic of PagedListModelCache.

Screen Shot 2021-06-23 at 00 07 50

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:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
yqritccommented, Dec 13, 2021

@elihart

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.

PagedDataEpoxyController and PagedDataModelCache already exist in epoxy-paging3 module. I believe PagedListEpoxyController and PagedListModelCache 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.

1reaction
elihartcommented, Jun 23, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

getting runtime error when updating paging library from 3.0.0 ...
2 and androidx. paging:paging-runtime:3.0. 0-alpha12 . I fixed it by changing the paging version to 3.1.
Read more >
Reverse dependencies for base
16604 Reverse deps, Accepted versions ... aws-lambda-haskell-runtime-wai, >=4.7 && <5 ... bytestring-rematch, >=4.5.0 && <4.6.
Read more >
Firebase Dynamic Links for Php and Laravel - kandi
Implement dynamic-links with how-to, Q&A, fixes, code snippets. kandi ratings - Low support, No Bugs, 10 Code smells, No License, Build available.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found