Hi, I started migrating our Dagger 2 + Dagger application codebase screen by screen to Hilt, but I faced one issue when trying to migrate tests as well. There is no documentation about migration of UI or Integration tests, there is just section about Testing. I've tried to do like it is described there and getting this exception on Test start. I've migrated activity and fragment already which is being tested.
java.lang.RuntimeException: dagger.hilt.android.testing.HiltTestApplication does not implement dagger.android.HasAndroidInjector
at dagger.android.AndroidInjection.inject(AndroidInjection.java:49)
at dagger.android.support.DaggerAppCompatActivity.onCreate(DaggerAppCompatActivity.java:52)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:702)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
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)
I've also tried to make CustomTestApplication and inject androidInjector manually for migration time being, but there is another exception saying that injections are not possible in CustomTestApplication. What are the ways to solve that puzzle?
Hi, I started migrating our Dagger 2 + Dagger application codebase screen by screen to Hilt, but I faced one issue when trying to migrate tests as well. There is no documentation about migration of UI or Integration tests, there is just section about Testing. I've tried to do like it is described there and getting this exception on Test start. I've migrated activity and fragment already which is being tested.
I've also tried to make CustomTestApplication and inject androidInjector manually for migration time being, but there is another exception saying that injections are not possible in CustomTestApplication. What are the ways to solve that puzzle?
Will appreciate any help. Thanks!