Detox icon indicating copy to clipboard operation
Detox copied to clipboard

Error: cannot access Detox import com.wix.detox.Detox

Open GabrielMerigo opened this issue 11 months ago • 6 comments

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:

Screenshot 2024-03-12 at 11 49 17

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:

Screenshot 2024-03-12 at 11 54 49

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 :/ Screenshot 2024-03-12 at 12 18 32

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?

Help us reproduce this issue!

  1. Configure the app on android (following the docs)
  2. 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

GabrielMerigo avatar Mar 12 '24 15:03 GabrielMerigo

I can bypass this issue by downgrading detox to version 20.1.4

su0329 avatar Mar 18 '24 04:03 su0329

I fixed it by modifying this line in the build.gradle file: 'androidTestImplementation('com.wix:detox-legacy:+')'.

KaterinaUK avatar May 22 '24 08:05 KaterinaUK

Same issue in my expo project image

jgalianoz avatar Jul 02 '24 16:07 jgalianoz

same issue

vladimirevstratov avatar Jul 16 '24 17:07 vladimirevstratov

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

ilies-space avatar Jul 22 '24 14:07 ilies-space

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 🔥

ilies-space avatar Jul 22 '24 15:07 ilies-space