Detox
Detox copied to clipboard
Error: cannot access Detox import com.wix.detox.Detox
What happened?
Hello Guys! How have you been?
I'm having a problem when I'm trying to build the android emulator to run detox tests. When I run:
npx detox build --configuration android.emu.debug
I'm getting this error here:
It seems like the error happens because is not finding the detox on my node_modules
maybe...
But I made all the config mentioned.
Detox added at android/build.gradle
:
Approach that I had
I read on Detox releases that on detox 20.18.5, Java 17 is required.
I'm working with Java 11, so, I made the suggested change by release docs but I didn't have good results :/
What was the expected behaviour?
Build android emulator to run the tests sucessfully;
Was it tested on latest Detox?
- [X] I have tested this issue on the latest Detox release and it still reproduces.
Did your test throw out a timeout?
- [X] I have followed the instructions under Identifying which synchronization mechanism causes us to wait too much.
Help us reproduce this issue!
- Configure the app on android (following the docs)
- run
npx detox build --configuration android.emu.debug
In what environment did this happen?
Detox version: 20.18.5 React Native version: 0.72.10 Has Fabric (React Native's new rendering system) enabled: no Node version: v20.11.1 Device model: Android Emulador (Pixel_2_API_31) Android version:
openjdk version "11.0.22" 2024-01-16 LTS
OpenJDK Runtime Environment Zulu11.70+15-CA (build 11.0.22+7-LTS)
OpenJDK 64-Bit Server VM Zulu11.70+15-CA (build 11.0.22+7-LTS, mixed mode)
Test-runner: jest
Detox logs
Detox logs
paste logs here!
Device logs
Device logs
paste your device.log here!
More data, please!
No response
I can bypass this issue by downgrading detox to version 20.1.4
I fixed it by modifying this line in the build.gradle file: 'androidTestImplementation('com.wix:detox-legacy:+')'.
Same issue in my expo project
same issue
I can bypass this issue by downgrading detox to version 20.1.4
Unfortunately this solved the mentioned issue, but created another issue TypeError: by.testID is not a function
I fixed it by modifying this line in the build.gradle file: 'androidTestImplementation('com.wix:detox-legacy:+')'.
That solved the issue for me, Thanks @KaterinaUK 🔥