You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
As observed in internal projects, it seems that when minification is enabled (over react native itself in particular), Detox can find itself in troubling situations due to usage of reflection.
Therefore, it'd be better (and future-proof) if we minify the test app and introduce proguard rules to protect Detox in that sense.
Describe the solution you'd like
Minify react-native in test app and introduce a proper proguard rules schema, integrated into the build.gradle.
Describe alternatives you've considered
N/A
Additional context
This is an error effectively observed in one of the internal projects:
E java.lang.NoSuchMethodException: No similar method getUIViewOperationQueue with params [] could be found on type class com.facebook.react.uimanager.UIImplementation.
E at org.joor.Reflect.similarMethod(Reflect.java:488)
E at org.joor.Reflect.call(Reflect.java:418)
E at org.joor.Reflect.call(Reflect.java:364)
E at com.wix.detox.espresso.ReactNativeUIModuleIdlingResource.isIdleNow(ReactNativeUIModuleIdlingResource.java:83)
E at android.support.test.espresso.base.IdlingResourceRegistry.allResourcesAreIdle(IdlingResourceRegistry.java:265)
E at android.support.test.espresso.base.IdlingResourceRegistry$6.isIdleNow(IdlingResourceRegistry.java:299)
The text was updated successfully, but these errors were encountered:
After a bit of an investigation work, it seems that since Detox is a test-dependency in its hosting apps, proguard usage is a bit tangled. Here are some insights I believe are important and true:
Since Detox is a test-dep (androidTestImplementation), whatever we put inside our proguard-rules.pro only affects the androidTest apk (typically under android/app/build/outputs/mapping/androidTest/...). Therefore, there's no point in trying to add rules such as -keep class com.facebook.react.**, since they are effectively scarce.
Unlike what the documentation for consumerProguardFiles says, it does bring the associated rules files into affect even if the library isn't served as an aar (as in our case) -- so we ought to keep it starting now.
Continuing point 1, still a need remains of affecting the actual (production) apk when running in instrumentation mode. This is what the testProguardFiles is for. In our case, since we need to have all of facebook available, this is the way to go (i.e. introducing a custom test proguard rules files and subscribing it using testProguardFiles).
In actual apps, no need to copy and paste RN's proguard-rules.pro into the app's custom rules file. It's used automatically since RN declares it using consumerProguardFiles. Depending on whether running fromSource or fromBin, it uses the rules file either in the root or inside the aar itself (respectively).
On 2nd though, point 3 doesn't make sense as the apk gets compiled once, and once only. So the only choice here I guess is for users to create a test-specific build type (e.g. releaseTest) -- where all of react native is included; We need to really well document that :-/
Note: this could be the reason as to why this old SO question has never been solved :)
Is your feature request related to a problem? Please describe.
As observed in internal projects, it seems that when minification is enabled (over react native itself in particular), Detox can find itself in troubling situations due to usage of reflection.
Therefore, it'd be better (and future-proof) if we minify the test app and introduce proguard rules to protect Detox in that sense.
Describe the solution you'd like
Minify react-native in test app and introduce a proper proguard rules schema, integrated into the
build.gradle
.Describe alternatives you've considered
N/A
Additional context
This is an error effectively observed in one of the internal projects:
The text was updated successfully, but these errors were encountered: