Skip to content

Instantly share code, notes, and snippets.

@abdyer
Last active March 7, 2020 13:22
Show Gist options
  • Save abdyer/053a04804d2d1cafcafd8ba7f54a8877 to your computer and use it in GitHub Desktop.
Save abdyer/053a04804d2d1cafcafd8ba7f54a8877 to your computer and use it in GitHub Desktop.
A custom AndroidBenchmarkRunner for benchmarks on CI
class BenchmarkRunner : AndroidBenchmarkRunner() {
override fun newApplication(
cl: ClassLoader?,
className: String?,
context: Context?
): Application {
// Create an instance of our custom Application class for benchmark tests
return super.newApplication(cl, BenchmarkApp::class.java.name, context)
}
override fun onCreate(arguments: Bundle?) {
val newArguments = arguments ?: Bundle()
/* This is how we enable output on FirebaseTestLab, as the
environment variable name isn't valid there. */
newArguments.putString("androidx.benchmark.output.enable", "true")
super.onCreate(newArguments)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment