wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.2k stars 1.92k forks source link

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

Open GabrielMerigo opened 7 months ago

GabrielMerigo commented 7 months ago

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?

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

su0329 commented 7 months ago

I can bypass this issue by downgrading detox to version 20.1.4

KaterinaUK commented 5 months ago

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

jgalianoz commented 3 months ago

Same issue in my expo project

image
vladimirevstratov commented 3 months ago

same issue

ilies-space commented 3 months ago

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 commented 3 months ago

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 🔥