What do these Hilt errors mean and why is my android 32 application now crashing on launch
having upgraded my android application to
compileSdkVersion 32
buildToolsVersion "32.0.0"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 26
targetSdkVersion 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
i am now seeing these build messages
> Task :app:hiltAggregateDepsStagingDebug
WARNING: [Processor] Library '/Users/ulbrichtrw/.gradle/caches/transforms-3/16015df75f1841f59f18fa48255d2c0f/transformed/core-1.7.0-api.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/core/R$styleable'
Example of support library reference: 'android/support/v4/app/INotificationSideChannel$Default'
WARNING: [Processor] Library '/Users/ulbrichtrw/.gradle/caches/transforms-3/36813b047f20ef4bcb69a988a1823888/transformed/media-1.0.0-api.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/media/R$styleable'
Example of support library reference: 'android/support/v4/media/MediaBrowserCompat$CallbackHandler'
WARNING: [Processor] Library '/Users/ulbrichtrw/.gradle/caches/transforms-3/c02b02e710117d58e0dab02dffab908d/transformed/browser-1.4.0-api.jar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/browser/R$xml'
Example of support library reference: 'android/support/customtabs/ICustomTabsCallback$Default'
The version of android studio is
Android Studio Bumblebee | 2021.1.1 RC 1
Build #AI-211.7628.21.2111.8005941, built on December 15, 2021
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry: external.system.auto.import.disabled=true, debugger.watches.in.variables=false
Non-Bundled Plugins: org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40)
The version of hilt is
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.40.5'
api 'com.google.dagger:hilt-android:2.40.5'
api "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
kapt "androidx.hilt:hilt-compiler:1.0.0"
kapt 'com.google.dagger:hilt-android-compiler:2.40.5'
When I build and launch my application it crashes immediately with this exception
2022-01-14 09:47:03.015 17685-17685/com.my.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.my.app, PID: 17685
java.lang.RuntimeException: Unable to instantiate application com.my.app.MyApplication package com.my.app: java.lang.ClassNotFoundException: Didn't find class "com.my.app.MyApplication" on path: DexPathList[[zip file "/data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/lib/arm64, /data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1364)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6686)
at android.app.ActivityThread.access$1500(ActivityThread.java:247)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.my.app.MyApplication" on path: DexPathList[[zip file "/data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/lib/arm64, /data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
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:1356)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6686)
at android.app.ActivityThread.access$1500(ActivityThread.java:247)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2053)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/elsevier/knovel/Hilt_MyApplication;
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
... 15 more
Caused by: java.lang.ClassNotFoundException: com.my.app.Hilt_MyApplication
at java.lang.VMClassLoader.findLoadedClass(Native Method)
at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ldagger/hilt/internal/GeneratedComponentManagerHolder;
... 18 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "dagger.hilt.internal.GeneratedComponentManagerHolder" on path: DexPathList[[zip file "/data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/lib/arm64, /data/app/~~SCdopZBpZDBd2FQ80g7S9w==/com.my.app-5K9szghSkFNozBisWLbB2Q==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 18 more
where have i gone wrong?
how do i resolve this issue?
UPDATE i have identified the root cause was that i had also upgraded the version of newrelic to 6.4.0. once i reverted this gradle change my app can launch
I have identified the root cause of my issue
I also upgraded the newrelic
library at the same time I migrated to Android 32. it was newrelic causing the issue, once i reverted the newrelic gradle change my app built and launched with no issues.
The newrelic gradle change i implemented was to increase the version from
classpath 'com.newrelic.agent.android:agent-gradle-plugin:6.3.1'
To this most recent version
classpath 'com.newrelic.agent.android:agent-gradle-plugin:6.4.0'