[Android 13] Bump instrumentation test runner version to support API 33
Now instrumentation tests launch on API 33 fails with the following error:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.mapbox.navigation.instrumentation_tests.test/androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2158)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1805)
at androidx.test.runner.MonitoringInstrumentation.execStartActivity(MonitoringInstrumentation.java:564)
at android.app.ContextImpl.startActivity(ContextImpl.java:1101)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:454)
at androidx.test.core.app.InstrumentationActivityInvoker.startActivity(InstrumentationActivityInvoker.java:431)
at androidx.test.core.app.InstrumentationActivityInvoker.startActivity(InstrumentationActivityInvoker.java:437)
at androidx.test.core.app.ActivityScenario.launchInternal(ActivityScenario.java:265)
at androidx.test.core.app.ActivityScenario.launch(ActivityScenario.java:195)
at androidx.test.ext.junit.rules.ActivityScenarioRule.lambda$new$0$ActivityScenarioRule(ActivityScenarioRule.java:70)
at androidx.test.ext.junit.rules.ActivityScenarioRule$$Lambda$0.get(ActivityScenarioRule.java:70)
at androidx.test.ext.junit.rules.ActivityScenarioRule.before(ActivityScenarioRule.java:103)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
at com.adevinta.android.barista.rule.cleardata.ClearDatabaseRule$apply$1.evaluate(ClearDatabaseRule.kt:31)
at com.adevinta.android.barista.rule.cleardata.ClearPreferencesRule$1.evaluate(ClearPreferencesRule.java:26)
at com.adevinta.android.barista.rule.cleardata.ClearFilesRule$apply$1.evaluate(ClearFilesRule.kt:25)
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.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
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:444)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2322)
Took it for a spin with the latest alphas: I get the same error. We should wait until they release API 33 support and bump the version accordingly.
OK, so there is a version that supports API 33: 1.5.0-alpha2 (https://github.com/android/android-test/issues/1412#issuecomment-1227563734) but it requires Kotlin 1.7. As far as I understand, we are not ready to bump that one yet (https://github.com/mapbox/mapbox-navigation-android/pull/6179).
So we can't update to the latest version of androidx test runner which supports API 33 just yet. It only means we cannot run tests on devices with API 33, it does not block bumping target and compile versions. But there is a workaround. But we only run instrumentation tests on predefined API levels (not including 33 for now). There are 2 options:
- Leave everything as-is and wait until we bump kotlin;
- Implement the temporary workaround and add API 33 to Firebase Test Lab (should we also remove some older API?). @mapbox/navigation-android WDYT? Do we want to run instrumentations tests on API 33 with the workaround now? I've only run them once locally when exploring the Android 13 changes, they worked, but there's no guarantee a new test won't fail.
I vote for the second option
Workaround PR: https://github.com/mapbox/mapbox-navigation-android/pull/6319
After that the issue goes in "To Track" because we wait until we can bump kotlin to 1.7.