Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When updating from v20.28 to v20.31 android build fails with "This declaration needs opt-in. Its usage must be marked with '@kotlin.ExperimentalStdlibApi" #4678

Open
2 tasks done
Overtorment opened this issue Jan 5, 2025 · 0 comments

Comments

@Overtorment
Copy link

Overtorment commented Jan 5, 2025

What happened?

Trying to update Detox, and cant compile android build , get error:

e: file:///xxxxx/node_modules/detox/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/ReactNativeIdlingResources.kt:115:29 This declaration needs opt-in. Its usage must be marked with '@kotlin.ExperimentalStdlibApi' or '@OptIn(kotlin.ExperimentalStdlibApi::class)'

looks like minor issue, but it is inside detox internals, in node_modules.

tried to bump kotlin version to latest, but that didnt solve it.

managed to solve it by adding compiler args to my build.gradle:

diff --git a/android/build.gradle b/android/build.gradle
index 1615d0e3cb..bfe95e8f6c 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -66,6 +66,7 @@ subprojects {
             }
         }
         tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
+            kotlinOptions.freeCompilerArgs += ["-Xopt-in=kotlin.ExperimentalStdlibApi"]
             if (project.plugins.hasPlugin("com.android.application") || project.plugins.hasPlugin("com.android.library")) {
                 kotlinOptions.jvmTarget = android.compileOptions.sourceCompatibility
             } else {

but that doesnt feel right

What was the expected behaviour?

No response

Was it tested on latest Detox?

  • 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!

the issue reproduces pretty reliably on our CI: BlueWallet/BlueWallet#7431

In what environment did this happen?

Detox version: 20.31
React Native version: 0.75.4
Has Fabric (React Native's new rendering system) enabled: (yes/no)
Node version: na
Device model: na
Android version: na
Test-runner (select one): na

Detox logs

Detox logs
paste logs here!

Device logs

Device logs
paste your device.log here!

More data, please!

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant