4

I'm attempting to run a specific android test (JUnit & Espresso), but get the following error: Error

I'm executing the test as so (debug): Running Test

The app is successfully installed and usable after the process.

The directory /Users/user/Projects/kiwix-android/app/build/outputs/apk/androidTest/ does not exist and is not created, let alone the app-kiwix-debug-androidTest.apk file itself.

My aim is to be able to debug (breakpoints etc.) individual tests on a real device. All suggestions welcome!

Joseph Reeve
  • 460
  • 3
  • 13
  • 1
    Maybe [this](https://stackoverflow.com/questions/34039834/the-apk-file-does-not-exist-on-disk?answertab=active#tab-top) can help you out? – sj0rske Apr 06 '18 at 13:21

1 Answers1

3

This seems to be a bug in Android Studio. The tests don't seem to get compiled before it attempts to install and run them. So, you need to compile them beforehand

./gradlew assembleDebugAndroidTest -x test

After you do this, you should be able to run/debug using Android Studio. Note that if you make any changes in your test code, you'll need to run the above command again.

aaronvargas
  • 12,189
  • 3
  • 52
  • 52