CameraXbasic aims to demonstrate how to use CameraX APIs written in Kotlin.
To build the app directly from the command line, run:
./gradlew assembleDebugUnit testing and instrumented device testing share the same code. To test the app using Robolectric, no device required, run:
./gradlew testTo run the same tests in an Android device connected via ADB, run:
./gradlew connectedAndroidTestAlternatively, test running configurations can be added to Android Studio for convenience (and a nice UI). To do that:
- Go to:
Run>Edit Configurations>Add New Configuration. - For Robolectric select
Android JUnit, for connected device selectAndroid Instrumented Tests. - Select
appmodule andcom.android.example.cameraxbasic.MainInstrumentedTestclass. - Optional: Give the run configuration a name, like
test robolectricortest device