2
votes

I am doing detox test for react native android version 0.57. I am getting this error.

Error is

Error: 'D:\folder\android\app\build\outputs\apk\androidTest\dev\debug\app-dev-debug-androidTest.apk' could not be found, did you run './gradlew assembleAndroidTest' ?

Package.json

"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/dev/debug/app-dev-debug.apk",
"build": "cd android && .\\gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.attached",
"name": "192.168.83.101:5555"

}

Error picture enter image description here

3

3 Answers

3
votes

This error is usually caused but not having built the test apk. It can usually be resolved by running

detox build -c android.emu.debug

If you make changes to your application you should always run the above script before running any test.

I usually run the following script to make sure that the build is uptodate before testing.

detox build -c android.emu.debug && detox test -c android.emu.debug
2
votes

Detox has strange behavior where it mutates your path to your apk, if you specify it in binaryPath.

To specify the exact path to your apk, add an entry for testBinaryPath that points to the APK you want Detox to use.

1
votes

change path android/app/build/outputs/apk/dev/debug/app-dev-debug.apk to android/app/build/outputs/apk/debug/app-debug.apk and detox automatically will create apk to path android/app/build/outputs/apk/AndroidTest/debug/app-debug-androidTest.apk