sergei-lapin/napt

ClassNotFoundException with 1.18

naveenccmsd opened this issue · 4 comments

With recent verions 1.18 Getting below exception.

It's working if we use
kapt ("com.google.dagger:hilt-compiler:$hiltVersion")
or kapt 1.17

Process: app.lawnchair.lawnicons, PID: 30361
java.lang.RuntimeException: Unable to instantiate application app.lawnchair.lawnicons.LawniconsApplication package app.lawnchair.lawnicons: java.lang.ClassNotFoundException: Didn't find class "app.lawnchair.lawnicons.LawniconsApplication" on path: DexPathList[[zip file "/data/app/~~o-8lXcw91hImyuOEZLyQHA==/app.lawnchair.lawnicons-uObhy24i-P4ZEGnIwQesoQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~o-8lXcw91hImyuOEZLyQHA==/app.lawnchair.lawnicons-uObhy24i-P4ZEGnIwQesoQ==/lib/arm64, /system/lib64, /system/system_ext/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1465)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7540)
at android.app.ActivityThread.access$1600(ActivityThread.java:315)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2286)
at android.os.Handler.dispatchMessage(Handler.java:106)
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 "app.lawnchair.lawnicons.LawniconsApplication" on path: DexPathList[[zip file "/data/app/~~o-8lXcw91hImyuOEZLyQHA==/app.lawnchair.lawnicons-uObhy24i-P4ZEGnIwQesoQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~o-8lXcw91hImyuOEZLyQHA==/app.lawnchair.lawnicons-uObhy24i-P4ZEGnIwQesoQ==/lib/arm64, /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)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:52)
at android.app.Instrumentation.newApplication(Instrumentation.java:1177)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1457)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7540) 
at android.app.ActivityThread.access$1600(ActivityThread.java:315) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2286) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
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) 
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lapp/lawnchair/lawnicons/Hilt_LawniconsApplication;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)

Reference:
LawnchairLauncher/lawnicons#827

Hi, @naveenccmsd, could you give v1.19 a try and check if the issue is still relevant?

@sergei-lapin we are getting same exception with 1.19 as well.

I cloned your repo and successfully launched app compiled with napt 1.19, so no problem with napt.
Seems like you have some sort of apk packaging issue, not sure of the origin, try running with --rerun-tasks.

Sorry , seems some issue in my local setup, Now the issue is resolved.

https://github.com/LawnchairLauncher/lawnicons/actions/runs/3474034827

LawnchairLauncher/lawnicons#830