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

[0.48.1] [Android] Bug: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class #15621

Closed
iegik opened this issue Aug 23, 2017 · 6 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@iegik
Copy link

iegik commented Aug 23, 2017

Is this a bug report?

yes

Have you read the Contributing Guidelines?

yes

Environment

  1. react-native -v:
    react-native-cli: 2.0.1
    react-native: 0.48.1
  2. node -v:
    v8.4.0
  3. npm -v:
    5.3.0
  4. yarn --version:

Then, specify:

  • Target Platform: Android 7.1.1 android-25
classpath 'com.android.tools.build:gradle:2.3.3' // For Android 7 (O)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 25
        ndk {
            // Test all dependences on x64 devices (might not work)
            // https://github.com/facebook/react-native/issues/2814
            abiFilters "armeabi-v7a", "x86"
        }
        multiDexEnabled true
        packagingOptions {
            exclude "lib/arm64-v8a/librealm-jni.so"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            // include "armeabi-v7a", "x86"
            include 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips', 'x86', 'x86_64'
        }
    }
    buildTypes {
        debug {
            shrinkResources true
            debuggable true
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "devsupport.pro"
            applicationIdSuffix ".debug"
        }
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
}

...

    compile "com.android.support:appcompat-v7:26.0.0-alpha1"

  • Development Operating System: macOS 10.12.6
  • Build tools:

Steps to Reproduce

(Write your steps here:)

  1. cd android && ./gradlew clean && cd ..
  2. node node_modules/react-native/local-cli/cli.js run-android
  3. Open app in Emulator

Expected Behavior

App works as in react-native v0.45.1

Actual Behavior

App crashes at start

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Fail to build an application on android-25 with ProGuard enabled

java.lang.NoSuchFieldError: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class "Lcom/facebook/react/bridge/JavaScriptExecutor;" or its superclasses
	at com.facebook.react.bridge.CatalystInstanceImpl.initializeBridge(Native Method)
	at com.facebook.react.bridge.CatalystInstanceImpl.<init>(SourceFile:114)
	at com.facebook.react.bridge.CatalystInstanceImpl.<init>(SourceFile:42)
	at com.facebook.react.bridge.CatalystInstanceImpl$b.a(SourceFile:574)
	at com.facebook.react.l.a(SourceFile:999)
	at com.facebook.react.l.a(SourceFile:109)
	at com.facebook.react.l$4.run(SourceFile:802)
	at java.lang.Thread.run(Thread.java:818)
SFEffectCache:clear(), mSize = 0

react-native-cli: 2.0.1
react-native:

latest
0.48.1
0.47.2
0.47.1
0.47.0
0.47.0-rc.3
0.46.4

Works on:
#0.45.1

Relative: #15619

@iegik
Copy link
Author

iegik commented Aug 31, 2017

Could be related #6692

@iegik
Copy link
Author

iegik commented Sep 5, 2017

Please, help

Full stack:

09-05 10:28:04.001: D/NetworkSecurityConfig(23526): No Network Security Config specified, using platform default
09-05 10:28:04.025: D/ReactNative(23526): ReactInstanceManager.createReactContextInBackground()
09-05 10:28:04.025: D/ReactNative(23526): ReactInstanceManager.recreateReactContextInBackgroundInner()
09-05 10:28:04.179: W/unknown:ReactNative(23526): Packager connection already open, nooping.
09-05 10:28:04.179: W/unknown:ReactNative(23526): Inspector connection already open, nooping.
09-05 10:28:04.182: I/zygote(23526): Background concurrent copying GC freed 2734(1272KB) AllocSpace objects, 2(40KB) LOS objects, 69% free, 659KB/2MB, paused 723us total 158.462ms
09-05 10:28:04.200: D/OpenGLRenderer(23526): HWUI GL Pipeline
09-05 10:28:04.210: D/ReactNative(23526): ReactInstanceManager.onReloadWithJSDebugger()
09-05 10:28:04.211: D/ReactNative(23526): ReactInstanceManager.recreateReactContextInBackground()
09-05 10:28:04.211: D/ReactNative(23526): ReactInstanceManager.runCreateReactContextOnNewThread()
09-05 10:28:04.307: I/zygote(23526): Thread[22,tid=23558,Native,Thread*=0xa2142400,peer=0x12c44db0,"Thread-2"] recursive attempt to load library "/data/app/com.acme.app.debug-odfgAf2U_QkVWx5p2PykHA==/lib/x86/libfb.so"
09-05 10:28:04.315: D/ReactNative(23526): ReactInstanceManager.createReactContext()
09-05 10:28:04.338: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.lwansbrough.RCTCamera.RCTCameraViewManager
09-05 10:28:04.356: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.uimanager.g
09-05 10:28:04.365: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager
09-05 10:28:04.366: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.art.a
09-05 10:28:04.367: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager
09-05 10:28:04.369: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.art.b
09-05 10:28:04.371: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager
09-05 10:28:04.371: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.art.e
09-05 10:28:04.373: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager
09-05 10:28:04.380: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
09-05 10:28:04.382: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
09-05 10:28:04.383: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
09-05 10:28:04.387: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
09-05 10:28:04.388: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.progressbar.b
09-05 10:28:04.391: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
09-05 10:28:04.397: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
09-05 10:28:04.401: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$a
09-05 10:28:04.403: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
09-05 10:28:04.404: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$a
09-05 10:28:04.406: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.toolbar.ReactToolbarManager
09-05 10:28:04.414: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.webview.ReactWebViewManager
09-05 10:28:04.420: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
09-05 10:28:04.432: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewManager
09-05 10:28:04.445: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.art.d
09-05 10:28:04.451: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
09-05 10:28:04.452: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.text.frescosupport.a
09-05 10:28:04.455: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
09-05 10:28:04.460: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
09-05 10:28:04.462: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.modal.b
09-05 10:28:04.465: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
09-05 10:28:04.469: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.text.g
09-05 10:28:04.472: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
09-05 10:28:04.480: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.textinput.j
09-05 10:28:04.484: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
09-05 10:28:04.485: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
09-05 10:28:04.489: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager
09-05 10:28:04.490: W/unknown:ViewManagerPropertyUpdater(23526): Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
09-05 10:28:04.501: D/ReactNative(23526): Initializing React Xplat Bridge.
09-05 10:28:04.507: D/ReactNative(23526): Initializing React Xplat Bridge before initializeBridge
09-05 10:28:04.509: E/AndroidRuntime(23526): FATAL EXCEPTION: Thread-2
09-05 10:28:04.509: E/AndroidRuntime(23526): Process: com.acme.app.debug, PID: 23526
09-05 10:28:04.509: E/AndroidRuntime(23526): java.lang.NoSuchFieldError: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class "Lcom/facebook/react/bridge/JavaScriptExecutor;" or its superclasses
09-05 10:28:04.509: E/AndroidRuntime(23526): 	at com.facebook.react.bridge.CatalystInstanceImpl.initializeBridge(Native Method)
09-05 10:28:04.509: E/AndroidRuntime(23526): 	at com.facebook.react.bridge.CatalystInstanceImpl.<init>(SourceFile:114)
09-05 10:28:04.509: E/AndroidRuntime(23526): 	at com.facebook.react.bridge.CatalystInstanceImpl.<init>(SourceFile:42)
09-05 10:28:04.509: E/AndroidRuntime(23526): 	at com.facebook.react.bridge.CatalystInstanceImpl$b.a(SourceFile:563)
09-05 10:28:04.509: E/AndroidRuntime(23526): 	at com.facebook.react.l.a(SourceFile:978)
09-05 10:28:04.509: E/AndroidRuntime(23526): 	at com.facebook.react.l.a(SourceFile:109)
09-05 10:28:04.509: E/AndroidRuntime(23526): 	at com.facebook.react.l$4.run(SourceFile:802)
09-05 10:28:04.509: E/AndroidRuntime(23526): 	at java.lang.Thread.run(Thread.java:764)
09-05 10:28:04.592: I/OpenGLRenderer(23526): Initialized EGL, version 1.4
09-05 10:28:04.592: D/OpenGLRenderer(23526): Swap behavior 1
09-05 10:28:04.592: W/OpenGLRenderer(23526): Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
09-05 10:28:04.592: D/OpenGLRenderer(23526): Swap behavior 0
09-05 10:28:04.594: D/EGL_emulation(23526): eglCreateContext: 0xafd323a0: maj 2 min 0 rcv 2
09-05 10:28:04.595: D/EGL_emulation(23526): eglMakeCurrent: 0xafd323a0: ver 2 0 (tinfo 0xafdecf90)
09-05 10:28:04.595: D/EGL_emulation(23526): [ 09-05 10:28:04.606 23526:23557 D/         ]
09-05 10:28:04.595: D/EGL_emulation(23526): SurfaceInterface::setAsyncMode: set async mode 1
09-05 10:28:04.622: D/EGL_emulation(23526): eglMakeCurrent: 0xafd323a0: ver 2 0 (tinfo 0xafdecf90)
09-05 10:28:05.525: D/EGL_emulation(23526): eglMakeCurrent: 0xafd323a0: ver 2 0 (tinfo 0xafdecf90)
09-05 10:28:10.060: A/libc(23526): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 23562 (HybridData Dest)

@iegik iegik changed the title Bug: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class [0.48.1] Bug: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class Sep 5, 2017
@iegik iegik changed the title [0.48.1] Bug: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class [0.48.1] [Android] Bug: no "Lcom/facebook/jni/HybridData;" field "mHybridData" in class Sep 5, 2017
@akshetpandey
Copy link

This should fix the crashes
In android/app/proguard-rules.pro

--keep,includedescriptorclasses class com.facebook.react.cxxbridge.ModuleRegistryHolder { *; }
--keep,includedescriptorclasses class com.facebook.react.cxxbridge.CatalystInstanceImpl { *; }
--keep,includedescriptorclasses class com.facebook.react.cxxbridge.JavaScriptExecutor { *; }
+-keep,includedescriptorclasses class com.facebook.react.bridge.CatalystInstanceImpl { *; }
+-keep,includedescriptorclasses class com.facebook.react.bridge.JavaScriptExecutor { *; }

@iegik
Copy link
Author

iegik commented Sep 20, 2017

@akshetpandey
Copy link

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
# -keepclassmembers class fqcn.of.javascript.interface.for.webview {
#    public *;
# }

# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
# -dontobfuscate

# Just Android Stuff
-dontwarn org.apache.http.**
-dontnote org.apache.http.**
-dontwarn android.net.http.**
-dontnote android.net.http.**

# React Native

# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation,includedescriptorclasses @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation,includedescriptorclasses @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation,includedescriptorclasses @interface com.facebook.common.internal.DoNotStrip

# SoLoader
-keep class com.facebook.soloader.** { *; }
-keepclassmembers class com.facebook.soloader.SoLoader {
     static <fields>;
}

# Do not strip any method/class that is annotated with @DoNotStrip
-keep,includedescriptorclasses @com.facebook.proguard.annotations.DoNotStrip class *
-keep,includedescriptorclasses @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers,includedescriptorclasses class * {
    @com.facebook.proguard.annotations.DoNotStrip *;
    @com.facebook.common.internal.DoNotStrip *;
}

-keepclassmembers,includedescriptorclasses @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
  void set*(***);
  *** get*();
}

-keep,includedescriptorclasses class * { native <methods>; }
-keep,includedescriptorclasses class * { @com.facebook.react.uimanager.UIProp <fields>; }
-keep,includedescriptorclasses class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keep,includedescriptorclasses class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
-keep,includedescriptorclasses class com.facebook.react.uimanager.UIProp { *; }

-keep,includedescriptorclasses class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep,includedescriptorclasses class * extends com.facebook.react.bridge.NativeModule { *; }
-keep,includedescriptorclasses class com.facebook.react.bridge.CatalystInstanceImpl { *; }
-keep,includedescriptorclasses class com.facebook.react.bridge.JavaScriptExecutor { *; }
-keep,includedescriptorclasses class com.facebook.react.bridge.queue.NativeRunnable { *; }
-keep,includedescriptorclasses class com.facebook.react.bridge.ExecutorToken { *; }
-keep,includedescriptorclasses class com.facebook.react.bridge.ReadableType { *; }

-dontwarn com.facebook.react.**
-dontnote com.facebook.**

# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
-dontwarn android.text.StaticLayout

# GIF Support

-keep,includedescriptorclasses class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl {
  public AnimatedFactoryImpl(com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory, com.facebook.imagepipeline.core.ExecutorSupplier);
}

# okhttp/okio

-keepattributes Signature
-keepattributes *Annotation*
-keep,includedescriptorclasses class okhttp3.** { *; }
-keep,includedescriptorclasses interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontnote okhttp3.**

-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault

-keep,includedescriptorclasses class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
-dontnote okio.**

# Adjust

-keep,includedescriptorclasses public class com.adjust.sdk.** { *; }
-keep,includedescriptorclasses class com.google.android.gms.common.ConnectionResult {
    int SUCCESS;
}
-keep,includedescriptorclasses class com.google.android.gms.ads.identifier.AdvertisingIdClient {
    com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep,includedescriptorclasses class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
    java.lang.String getId();
    boolean isLimitAdTrackingEnabled();
}
# -keep,includedescriptorclasses class dalvik.system.VMRuntime {
#     java.lang.String getRuntime();
# }
# -keep class android.os.Build {
#     java.lang.String[] SUPPORTED_ABIS;
#     java.lang.String CPU_ABI;
# }
# -keep class android.content.res.Configuration {
#     android.os.LocaledList getLocales();
#     java.util.Locale locale;
# }
# -keep,includedescriptorclasses class android.os.LocaledList {
#     java.util.Locale get(int);
# }

# Firebase

-keepattributes EnclosingMethod
-keepattributes InnerClasses

# React-native-config

-keep,includedescriptorclasses class com.thriller.BuildConfig { *; }

# IAB V3

-keep,includedescriptorclasses class com.android.vending.billing.**

# React native deps ignore
-dontwarn io.invertase.firebase.**
-dontwarn com.idehub.Billing.**
-dontwarn com.google.firebase.**
-dontwarn com.google.android.**
-dontnote com.google.**
-dontnote me.leolin.shortcutbadger.**
-dontnote com.brentvatne.**
-dontnote com.yqritc.**

@stale
Copy link

stale bot commented Nov 19, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 19, 2017
@stale stale bot closed this as completed Nov 26, 2017
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

2 participants