Closed kingdark1234 closed 3 years ago
Encountered the same issue as well. In android, it only builds successfully but it doesn't install in app when test is ran. I tried to manually install the apk and launch it and it works fine but when the test is ran, it doesn't install it, and when I launch the app when test is running, it just hang up and just shows white page.
No problem running in IOS. I already did the following:
Set the following in build.gradle
minSdkVersion = 26
targetSdkVersion = 27
ext.kotlinVersion = '1.3.72'
and added classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
Set in detoxrc
"android": {
"type": "android.apk",
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -"
}
Edit 8/25: After a few days of tweaking, reinstalling, following this guide: https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#6-enable-clear-text-unencrypted-traffic-for-detox, I tried this one. I'm just now sure if theres any effect in doing this.
Same issue in INSTRUMENTATION but the error is different.
_``` detox[11114] TRACE: [SPAWN_STDOUT, #11151] INSTRUMENTATION_RESULT: shortMsg=Process crashed. INSTRUMENTATION_CODE: 0
detox[11114] DEBUG: [SPAWN_END, #11151] /Library/Android/sdk/platform-tools/adb -s emulator-18698 shell am instrument -w -r -e detoxServer ws://localhost:55559 -e detoxSessionId 7d3f5487-a90a-1cf1-55bd-ca64ff6e4d1e -e debug false com.cardspal.test/android.test.InstrumentationTestRunner finished with code = 0 detox[11114] DEBUG: [EXEC_CMD, #27] "/Library/Android/sdk/platform-tools/adb" -s emulator-18698 reverse --remove tcp:55559 detox[11114] TRACE: [ARTIFACTS_LIFECYCLE] artifactsManager.onHookFailure({ error: DetoxRuntimeError: Failed to run application on the device
HINT: Most likely, your tests have timed out and called detox.cleanup() while it was waiting for "ready" message (over WebSocket) from the instrumentation process.
detox[11114] INFO: [1m[37mExample Screen Tests: [39m[22m[90mshould type into the text field[39m detox[11114] INFO: [1m[37mExample Screen Tests: [39m[22m[90mshould type into the text field[39m[90m [[31mFAIL[90m][39m
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions!
For more information on bots in this reporsitory, read this discussion.
@kingdark1234 you've specified your app apk
under both binaryPath
and testBinaryPath
.
"binaryPath": "android/app/build/outputs/apk/dev/release/app-dev-release.apk"
"testBinaryPath": "android/app/build/outputs/apk/dev/release/app-dev-release.apk"
For testBinaryPath
, you must use the test apk
. For example: android/app/build/outputs/apk/androidTest/dev/release/app-dev-release-androidTest.apk
. I think that in your case, you can leave testBinaryPath
empty and Detox will infer the right path, for you.
@kitoymonster please report through a different issue / stack-overflow 🙏🏻
Step to reproduce
After I run
detox build --configuration android.emu.dev.local
with config"app":{ "varun.android.dev.local": { "type": "android.apk", "binaryPath": "android/app/build/outputs/apk/dev/release/app-dev-release.apk", "testBinaryPath": "android/app/build/outputs/apk/dev/release/app-dev-release.apk", "build": "npm run build:android:e2e:develop" // my build command in package.json }, }
detox has built my app successfully then I run
detox test --configuration android.emu.dev.local --loglevel trace
with config"devices": { "simulator": { "type": "ios.simulator", "device": { "type": "iPhone 11" } }, "emulator": { "type": "android.emulator", "device": { "avdName": "Nexus" } } }, "configurations": { "android.emu.dev.local": { "device": "emulator", "app": "varun.android.dev.local" }, }
Then I got an error like this
import { cleanup, device, beforeEach } from 'detox'; import * as adapter from 'detox/runners/jest/adapter';
beforeAll(async () => { await device.launchApp({ newInstance: true }); });
beforeEach(async () => { await adapter.beforeEach(); await device.reloadReactNative(); });
afterAll(async () => { await adapter.afterAll() await cleanup(); });