I'm running Fragment tests inside a module (com.example.app.module) which is inside my app ( com.example.app)
When calling launchFragmentInContainer<T: Fragment>() I'm getting the next runtime error:
java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.app/androidx.fragment.app.testing.FragmentScenario$EmptyFragmentActivity (has extras) }
at androidx.test.core.app.InstrumentationActivityInvoker.startActivity(InstrumentationActivityInvoker.java:387)
at androidx.test.core.app.InstrumentationActivityInvoker.startActivity(InstrumentationActivityInvoker.java:416)
at androidx.test.core.app.ActivityScenario.launchInternal(ActivityScenario.java:265)
at androidx.test.core.app.ActivityScenario.launch(ActivityScenario.java:226)
at androidx.fragment.app.testing.FragmentScenario.internalLaunch(FragmentScenario.java:299)
at androidx.fragment.app.testing.FragmentScenario.launch(FragmentScenario.java:213)
at com.example.module.MyFragmentTest.setUp(MyFragmentTest.kt:322)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
[etc]
after some research, I found out that at build.gradle.kts this could be changed from:
androidTestImplementation("androidx.fragment:fragment-testing:1.2.5")
to:
debugImplementation("androidx.fragment:fragment-testing:1.2.5")
after changing it, I get a compilation error:
/Users/rafaelruizmunoz/com/example/module/build/intermediates/metadata_feature_manifest/debug/metadata-feature/AndroidManifest.xml:26:9-36:20: AAPT: error: resource style/FragmentScenarioEmptyFragmentActivityTheme (aka com.example.app:style/FragmentScenarioEmptyFragmentActivityTheme) not found.
I'm running it with AGP 4.0.2
How could I solve this?