Detox: Conflict with dependency 'org.jetbrains.kotlin:kotlin-stdlib' in project ':app'.

Describe the bug After following the documented guide for adding Android and trying to execute detox build -c android.emu.debug I get the following error.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:preBetaDebugAndroidTestBuild’.

Conflict with dependency ‘org.jetbrains.kotlin:kotlin-stdlib’ in project ‘:app’. Resolved versions for app (1.1.60) and test app (1.3.0) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.

Expected behavior The build to be successful and run tests on Android.

Steps taken I tried updating ext.kotlinVersion = '1.3.0' to 1.1.60 but that runs into error,

Could not find org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.1.60.

Environment (please complete the following information):

  • Detox:^12.0.0
  • React Native:0.55.3
  • Node:v11.12.0
  • Device: Any Android emulator
  • OS: Mac

Device and Verbose Detox Logs androidDependencies output. *I noticed

org.jetbrains.kotlin:kotlin-stdlib-jre7:1.1.60@jar

and

org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.0@jar

and suspect that is the root cause of the error but lack the knowledge to figure out how to solve it.

https://gist.github.com/JanithaR/c5c7b3be1ce6b26ca3e66feb7937c94c

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 27 (2 by maintainers)

Most upvoted comments

@JanithaR With detox, we were trying to not force library users to introduce kotlin into their projects if they don’t wish to. This is why we have the kotlin-stdlib-jdk declared as a dependency. Now it turns out that, though ironic, we could have made it difficult for projects that are already using kotlin - such as your own. I think the solution here is to cleverly make this dep conditional.

@JanithaR sorry, the jest demo project happened to have been broken. I’ve just finished fixing it. You can use the other (mocha) demo project if you like.

In an effort to understand how things should be configured more correctly I cloned the repo and tried to get the demo-react-native-jest project provided in the example to get to work. That also ends up in an error.

> Task :app:compileDebugAndroidTestJavaWithJavac FAILED
/Users/janithar/Desktop/Repos/Detox/examples/demo-react-native-jest/android/app/src/androidTest/java/com/demoreactnativejest/DetoxTest.java:26: error: incompatible types: android.support.test.rule.ActivityTestRule<MainActivity> cannot be converted to androidx.test.rule.ActivityTestRule
        Detox.runTests(mActivityRule);