I want to change the package name when this task is ran so I can have two instances of my application on device during testing, one for automation/unit tests and one for just installing the app normally. Currently, when i run ./gradlew connectedCheck, it overwrites the current app install, and deletes itself when finished.
You are wrestling with the default behavior of ‘android’ plugin described in http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Running-tests that wants to install the app, test it and uninstall the app. IMO there is a risk that whatever you find can break with their next update because it is still under development.
Can’t you just create a flavor for these instrumented tests and run {{./gradlew connectedInstrumentTestDebug}} ? The flavor can get its own package name.