I have submitted a react native App to google play internal testing , these tests show some Stability errors , the same aab file installed on my device and works just fine , debug mode also works fine with no errors , but at google play internal testing it shows errors saying :
java.lang.NoSuchFieldError: no "Lcom/facebook/jni/HybridData;" field
"mHybridData" in class "Lcom/shopify/reactnative/skia/SkiaDomView;" or
its superclasses
and another one saying :
Exception java.lang.RuntimeException: Unable to pause activity
{com.imagewatermarks/com.imagewatermarks.MainActivity}:
com.facebook.react.uimanager.IllegalViewOperationException: Trying to
add unknown view tag: 199 detail: View tag:239 View Type:class
com.facebook.react.views.view.ReactViewGroup children(1): [ 193, ],
viewsToAdd(1): [ [1,199], ], at
android.app.ActivityThread.performPauseActivityIfNeeded
(ActivityThread.java:4896) at
android.app.ActivityThread.performPauseActivity
(ActivityThread.java:4845) at
android.app.ActivityThread.handlePauseActivity
(ActivityThread.java:4796) at
android.app.servertransaction.PauseActivityItem.execute
(PauseActivityItem.java:46) at
android.app.servertransaction.TransactionExecutor.executeLifecycleState
(TransactionExecutor.java:176) at
android.app.servertransaction.TransactionExecutor.execute
(TransactionExecutor.java:97) at
android.app.ActivityThread$H.handleMessage (ActivityThread.java:2144)
at android.os.Handler.dispatchMessage (Handler.java:106) at
androidx.test.espresso.base.Interrogator.loopAndInterrogate
(Interrogator.java:10) at
androidx.test.espresso.base.UiControllerImpl.loopUntil
(UiControllerImpl.java:7) at
androidx.test.espresso.base.UiControllerImpl.loopUntil
(UiControllerImpl.java:1) at
androidx.test.espresso.base.UiControllerImpl.loopMainThreadForAtLeast
(UiControllerImpl.java:7) at
androidx.test.espresso.action.Tap$1.sendTap (Tap.java:4) at
androidx.test.espresso.action.GeneralClickAction.perform
(GeneralClickAction.java:4) at
androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform
(ViewInteraction.java:2) at
androidx.test.espresso.ViewInteraction.doPerform
(ViewInteraction.java:23) at
androidx.test.espresso.ViewInteraction.-$$Nest$mdoPerform at
androidx.test.espresso.ViewInteraction$1.call (ViewInteraction.java:6)
at androidx.test.espresso.ViewInteraction$1.call
(ViewInteraction.java:1) at java.util.concurrent.FutureTask.run
(FutureTask.java:266) at android.os.Handler.handleCallback
(Handler.java:938) at android.os.Handler.dispatchMessage
(Handler.java:99) at android.os.Looper.loop (Looper.java:240) at
android.app.ActivityThread.main (ActivityThread.java:8000) at
java.lang.reflect.Method.invoke at
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run
(RuntimeInit.java:603) at com.android.internal.os.ZygoteInit.main
(ZygoteInit.java:947) Caused by
com.facebook.react.uimanager.IllegalViewOperationException: Trying to
add unknown view tag: 199 detail: View tag:239 View Type:class
com.facebook.react.views.view.ReactViewGroup children(1): [ 193, ],
viewsToAdd(1): [ [1,199], ],
I read somewhere that the errors related to proguard file so they suggested to add some lines of code to my file so here is my proguard-rules.pro file :
-keep class com.facebook.react.cxxbridge.ModuleRegistryHolder { *; }
-keep class com.facebook.react.cxxbridge.CatalystInstanceImpl { *; }
-keep class com.facebook.react.cxxbridge.JavaScriptExecutor { *; }
-keep class com.facebook.react.bridge.queue.NativeRunnable { *; }
-keep class com.facebook.react.bridge.ExecutorToken { *; }
-keep class com.facebook.react.bridge.ReadableType { *; }
-keep class com.facebook.react.** { *; }
-keepclassmembers class com.facebook.react.** { *; }
and here is code from my /android/app/build.gradle:
def enableProguardInReleaseBuilds = true
….
buildTypes {
debug {
signingConfig signingConfigs.release
}
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
shrinkResources true
}
}
}
and from my android/build/build.gradle file :
buildscript {
ext {
buildToolsVersion = "30.0.3"
minSdkVersion = 30
compileSdkVersion = 33
targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}
after generating new aab file and submitting it these changes did not make any effect still the same errors show up in google play internal testing , could you please see if you can help . thank you.
3
Answers
for anyone facing similar issue I have solved that by adding to my prodguard file the class that fired the error , here it is :
and it worked.
It was completely the same as your issue, but I solved it. I didn’t have any related references or information, so thank you so much. How did you find this solution?
It’s an issue that can happen when integrating React Native into an existing Android project. It will only happen if your project’s Proguard rules do not include -dontobfuscate. The default Proguard rules file for React Native includes -dontobfuscate so this issue doesn’t happen in a pure React Native Android project.
To resolve follow the steps :
java.lang.NoSuchFieldError: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class "Lcom/facebook/react/bridge/JavaScriptExecutor;" or its superclasses
To fix, add the following to proguard-rules.pro:
-keep class com.facebook.react.bridge.CatalystInstanceImpl { *; }
-keep class com.facebook.react.bridge.JavaScriptExecutor { *; }
-keep class com.facebook.react.bridge.queue.NativeRunnable { *; }
-keep class com.facebook.react.bridge.ReadableType { *; }
I’m not entirely sure why the -dontobfuscate makes a difference. The classes I had to keep via Proguard rules are all annotated with @DoNotStrip
There’s also a Stack Overflow post about this here : Proguard app crash (Caused by: java.lang.NoSuchFieldError: no "Lcom/facebook/jni/HybridData).