kezong / fat-aar-android

A gradle plugin that merge dependencies into the final aar file works with AGP 3.+
MIT License
3.13k stars 621 forks source link

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/runtime/R$id; #413

Open MuthuHere opened 1 year ago

MuthuHere commented 1 year ago

I am creating a module to aar, when i create i am successfully can create aar. But when i run the instrumentation test all the sudden i am getting following error

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/lifecycle/runtime/R$id; at androidx.lifecycle.ViewTreeLifecycleOwner.set(ViewTreeLifecycleOwner.java:49) Tests on Pixel_XL_API_30(AVD) - 11 failed: Instrumentation run failed due to 'Process crashed.'

Build Environment

Mixermachine commented 1 year ago

I also encountered this problem. For now I moved my tests into an additional app module that implements my aar module as a dependency.

In the app module build.gradle add the following:

implementation(project(':myAarModule'))