I use this solution, to configure my Android Studio, to uninstall the previous app, before it executes the Espresso tests.
So, in Run -> Edit Configurations -> Before launch and then added the :app:uninstallAll so, when I run my testcase from AS, i only select the configuration, and it works well.
I use the ./gradlew connectedAndroidTest to execute the Espresso test from command line. But, I am wondering,
How may i ask the commandline of gradle to uninstall the previous version, before execution of test?
