Hilt makes testing easier on Android
Вставка
- Опубліковано 19 лип 2020
- The best android courses in the world: codingwithmitch.com/
Watch the HILT course here (FREE): codingwithmitch.com/courses/h...
Everything you need to know about writing android instrumentation tests if you using Hilt for dependency injection.
Code: github.com/mitchtabian/Dagger...
Instagram: / codingwithmitch
Twitter: / mitch_tabian
.
.
#AndroidDev - Наука та технологія
Thank you for this video
You're welcome. Always nice to be appreciated by my fans
@@codingwithmitch how to add voice message feature for chat app in andriod by using java .any api or packages available for the process pls tell me
Mitch, you are the best teacher I ever had, I was scratching my head over this launchFragmentInHiltContainer ,and finally landed in your video now it is pretty clear. big thanks
@Raji 👋
before each person watches the video says in mind, Ohh sexy shirt.
hi @CodingWithMitch congrats for the great video. Please do you have any example testing UIs?
Thanks, very helpful video! Is there a way to mock a ViewModel in a fragment test or how should i test it?
Thanks a lot, my teacher!
I could get the MainFragment without a factory.
Thanks, you are a lifesaver!
24:18 "android:exported" is required to be included in everywhere you use "intent-filter" after the SDK version 31. If you want your app to share intents from one specific class you should make it true, if not then false.
Can you make a video about package installer? No one has done video about that yet
even though I do not know anything about the android development, I still watch your videos, because I really enjoy the way you explain things. Would be really cool if you could make a react-native course
Maybe in the future who knows. I think react native is a better choice than flutter personally because JavaScript jobs are so easy to come by. It gives you more employment options
@@codingwithmitch how to add voice message feature for chat app in andriod studio .what is procedure or process and is there any api or packages to available to add voice message features
What a lovely comment :P :)
I gave up with React Native environment 😅 still love native
@@codingwithmitch Fact! I still wonder why Javascript jobs are so easy to come by?
Is it production ready or should I wait a little bit more?
can you do a tutorial retrofit + hiltandroidtest
Tks for #Hilt 👍
Hii hope you are doing well. I saw your old video on caching with retrofit. I have a question that how we can load data from cache first then from network if the Internet is available.
Watch my db caching course or powerful Android apps codingwithmitch.com/courses/powerful-android-apps-with-jetpack-architecture/
sharp guy
God bless you
Well, I wasted a bunch of time trying to get this to work for my unit tests yesterday guess I should have seen this video!
hahaha oh well.
Thank man
Hey Mitch , for someone who just have started about dependency injection do you recommend I pick up hilt over plain dagger?
Yeah its way easier. Dagger is good to know but learning curve is rough
Normal Dagger is only for people with 200 IQ
@@codinginflow Having followed your great tutorial on dagger a couple months ago I laughed harder than I should on this comment.
Hi Mitch, how can we launch the app using hiltAndroidTest approach? My app will starts from splachActivity and i would need to launch the app from splash activity.!
Superb
how to add voice message feature for chat app in andriod by using java .any api or packages available for the process pls tell me sir
developer.android.com/reference/android/speech/tts/TextToSpeech
help me pls
i get error
java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.codingwithmitch.daggerhiltplayground/.HiltTestActivity (has extras) }
Please check certificate of web site as it shows it's expired and chrome makes it unsafe to use your website.
Clear cache
What do u want???
$6000
Thanks for the video. I am getting the following exception while running the main fragment test of your code. I have tried with commitAllowingStateLoss() but failed. Can you help me anyway?
java.lang.RuntimeException: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at androidx.test.runner.MonitoringInstrumentation.runOnMainSync(MonitoringInstrumentation.java:441)
at androidx.test.core.app.ActivityScenario.onActivity(ActivityScenario.java:564)
at com.codingwithmitch.daggerhiltplayground.MainTest.mainFragmentTest(MainTest.kt:120)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
at dagger.hilt.android.internal.testing.MarkThatRulesRanRule$1.evaluate(MarkThatRulesRanRule.java:92)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:392)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2106)
Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1766)
at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1806)
at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:324)
at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:289)
at com.codingwithmitch.daggerhiltplayground.MainTest$mainFragmentTest$$inlined$launchFragmentInHiltContainer$1.perform(HiltExt.kt:72)
at com.codingwithmitch.daggerhiltplayground.MainTest$mainFragmentTest$$inlined$launchFragmentInHiltContainer$1.perform(Unknown Source:2)
at androidx.test.core.app.ActivityScenario.lambda$onActivity$2$ActivityScenario(ActivityScenario.java:551)
at androidx.test.core.app.ActivityScenario$$Lambda$4.run(Unknown Source:4)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2124)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
PC restart solves the problem. Thanks.
engagement
How are you 🥰
good
Why don't we do a full UI test instead of Unit and Integration tests?
I mean by ignoring the UI test time, UI tests can test everything in the real world.
Who agrees with me?
That one fkn dislike
Probably a Flutter baby