wix / Detox

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

[Android] Runtime crash cause of com.google.common.util.concurrent obfuscation #4458

Open aamagda opened 2 months ago

aamagda commented 2 months ago

What happened?

I use release build type with minifyEnabled true and follow official documentation at https://wix.github.io/Detox/docs/guide/proguard-configuration/

The app has crashed, see the details below:

    @Thread main(2):
    java.lang.NoSuchMethodError: No static method getFuture(Landroidx/concurrent/futures/CallbackToFutureAdapter$Resolver;)Lcom/google/common/util/concurrent/ListenableFuture; in class Landroidx/concurrent/futures/CallbackToFutureAdapter; or its super classes (declaration of 'androidx.concurrent.futures.CallbackToFutureAdapter' appears in /data/app/~~6OaKP9qTbxW_59VCDY5GTQ==/ru.profi.x.rn-aDUNh-0jDZGe90FX2tmLog==/base.apk)
        at androidx.test.core.app.ListFuture.<init>(ListFuture.java:72)
        at androidx.test.core.app.DeviceCapture$forceRedrawGlobalWindowViews$1.run(DeviceCapture.kt:168)
        at android.os.Handler.handleCallback(Handler.java:942)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7872)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

What was the expected behaviour?

Adding next rule fixes runtime crash -keep class com.google.common.util.concurrent.** { *; }

Was it tested on latest Detox?

Did your test throw out a timeout?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 20.20.2 React Native version: 0.72.12 Has Fabric (React Native's new rendering system) enabled: (yes/no) NO Node version: 20.7.0 Device model: pixel_3 Android version: system-images;android-33;default;arm64-v8a Test-runner (select one): jest / other

Detox logs

Detox logs ``` paste logs here! ```

Device logs

Device logs ``` paste your device.log here! ```

More data, please!

No response

stephenseager commented 1 month ago

Commenting to say i am also getting this exact same issue. However i never got the issue on React Native 0.72.6, i now experience it on React Native 0.74.1.