OnePlus Expresso Test Run Issue (Android Studio 3.6.2)

269 views Asked by At

I am an Android Developer and facing a very serious issue that isn't mentioned anywhere with solution.

I am trying to run Expresso automated tests on my oneplus6t. But every single time from a year I am unable to test.

The error message is something like this:

"Testing started at 09:46 AM ...
04/20 09:46:21: Launching 'ASyncSettingsTest' on OnePlus ONEPLUS A6010.
Running tests
$ adb shell am instrument -w -r -e debug false -e class 'com.declaree.declaree.ASyncSettingsTest' com.demo.test/androidx.test.runner.AndroidJUnitRunner
Timed out waiting for process (com.demo) to appear on oneplus-oneplus_a6010-21663687."

It's working in emulators and other manufacturing devices like pixel, moto, Samsung.

I do not find anything like this in the developer option too.

For tests to run, I have to open the application on my own then it runs.

FYI: Reboot, Reset, Wipe Cache doesn't work.

I am working in Android Studio 3.6.2

Does anybody have any solution? Thanks in advance.

1

There are 1 answers

6
Vladislav Yundin On BEST ANSWER

It is somehow related to oneplus specific restrictions of background work.

To get rid of this, go

Settings -> Battery -> Battery optimization -> Your app (not package.test but application) -> Don't optimize -> Done

Works on OnePlus 3t.