You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use your library with together the hilt(DI Library).
But, I encountered an error Unable to instantiate application com.example.myapplication.MainApplication.
Doesn't recognize the Application Class(MainApplication) when building.
please help me, thx.
Reproduction
Create a new Project with defalt.(Empty Compose Activity)
Add the settings at build.gradle (Project: My_Application).
@HiltAndroidApp // add
class MainApplication : Application()
Run the app. Unable to instantiate application com.example.myapplication.MainApplication: java.lang.ClassNotFoundException:
2022-06-23 10:26:09.881 18954-18954/com.example.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 18954
java.lang.RuntimeException: Unable to instantiate application com.example.myapplication.MainApplication: java.lang.ClassNotFoundException: Didn't find class "com.example.myapplication.MainApplication" on path: DexPathList[[zip file "/data/app/com.example.myapplication-ytHMBpWkgDmYGcXCZ6NxFg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.myapplication-ytHMBpWkgDmYGcXCZ6NxFg==/lib/arm64, /system/lib64, /system/product/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1226)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6431)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.myapplication.MainApplication" on path: DexPathList[[zip file "/data/app/com.example.myapplication-ytHMBpWkgDmYGcXCZ6NxFg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.myapplication-ytHMBpWkgDmYGcXCZ6NxFg==/lib/arm64, /system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
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:1148)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1218)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6431)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/example/myapplication/Hilt_MainApplication;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 14 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.myapplication.Hilt_MainApplication" on path: DexPathList[[zip file "/data/app/com.example.myapplication-ytHMBpWkgDmYGcXCZ6NxFg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.myapplication-ytHMBpWkgDmYGcXCZ6NxFg==/lib/arm64, /system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 17 more
The text was updated successfully, but these errors were encountered:
In my repro setup, this caused the app to behave properly. This uses a flag which is marked deprecated so there might be some more investigation to be done here but I was wanted to see if it also solves the problem for you.
I want to use your library with together the hilt(DI Library).
But, I encountered an error
Unable to instantiate application com.example.myapplication.MainApplication
.Doesn't recognize the Application Class(MainApplication) when building.
please help me, thx.
Reproduction
build.gradle
(Project: My_Application).build.gradle
(Module: My_Application.app).Add the implementations.
Add
android:name="com.example.myapplication.MainApplication"
atAndroidManifest.xml
.@HiltAndroidApp
Unable to instantiate application com.example.myapplication.MainApplication: java.lang.ClassNotFoundException:
The text was updated successfully, but these errors were encountered: