Search code examples
androidreact-nativegoogle-play

error after submitting app saying : java.lang.NoSuchFieldError


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.


Solution

  • for anyone facing similar issue I have solved that by adding to my prodguard file the class that fired the error , here it is :

    -keep class com.shopify.reactnative.skia.SkiaDomView {*;}

    and it worked.