react-native-community / jsc-android-buildscripts

Script for building JavaScriptCore for Android (for React Native but not only)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App crash, ReactNativeJS: React Native version mismatch. FATAL EXCEPTION: mqt_native_modules

janet-rivas opened this issue · comments

my app is crashing when I generated a release build and install the apk on my the android device

2019-07-23 10:54:56.833 24716-24774/? D/JavaScriptCore.Version: 241213.2.0 - adding this line for JavaScriptCore reference
2019-07-23 10:54:57.486 24716-24833/? E/ReactNativeJS: React Native version mismatch.
    
    JavaScript version: 0.49.5
    Native version: 0.59.8
    
    Make sure that you have rebuilt the native code. If the problem persists try clearing the watchman and packager caches with `watchman watch-del-all && react-native start --reset-cache`.
2019-07-23 10:54:57.490 3694-4935/? D/CustomFrequencyManagerService: releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 2600000  uid : 1000  pid : 3694  tag : APP_LAUNCH@CPU_MIN@330
    
    --------- beginning of crash
2019-07-23 10:54:57.493 24716-24834/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
    Process: com.officedepot.mobile.ui.sqs, PID: 24716
    com.facebook.react.common.JavascriptException: React Native version mismatch.
    
    JavaScript version: 0.49.5
    Native version: 0.59.8
    
    Make sure that you have rebuilt the native code. If the problem persists try clearing the watchman and packager caches with `watchman watch-del-all && react-native start --reset-cache`., stack:
    <unknown>@62:1035
    i@2:553
    n@2:266
    global code@1556:9
    
        at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
        at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
        at android.os.Looper.loop(Looper.java:154)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
        at java.lang.Thread.run(Thread.java:762)

Environment info

React native info output:

  React Native Environment Info:
    System:
      OS: macOS 10.14.5
      CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
      Memory: 131.00 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.12.0 - /usr/local/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 16, 23, 24, 25, 26, 27, 28
        Build Tools: 26.0.2, 26.0.3, 27.0.2, 27.0.3, 28.0.2, 28.0.3
        System Images: android-24 | Google Play Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom_64, android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
    IDEs:
      Android Studio: 3.4 AI-183.5429.30.34.5452501
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.6 => 16.8.6 
      react-native: 0.59.8 => 0.59.8 
    npmGlobalPackages:
      lottie-react-native: 2.6.1
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-img-cache: 1.6.0
      react-native-segmented-control-tab: 3.3.1

Library version:"jsc-android": "241213.2.0",

Steps To Reproduce

I setup this library for Android 64-bit support because it was crashing for sone Samsung devices and I included this configuration.

path - /android/app/build.gradle

android {
  packagingOptions {
        pickFirst '**/libjsc.so'
        pickFirst '**/libc++_shared.so'
    }
}

dependencies {
    // Make sure to put android-jsc at the the first
    implementation "org.webkit:android-jsc:r241213"
}

path - /android/build.gradle

allprojects {
    repositories {
        jcenter()
        google()
        mavenLocal()


        maven { url "https://jitpack.io" }
        maven {
            url 'https://maven.google.com/'
        }
        maven { url 'https://dl.bintray.com/android/android-tools' }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // Local Maven repo containing AARs with JSC library built for Android
            url "$rootDir/../node_modules/jsc-android/dist"
        }
        
        maven { url "https://repository.medallia.com/digital-maven/" }

    }
}

path myproject/package.json

"dependencies": {
 "jsc-android": "241213.2.0",
  "react": "16.8.6",
  "react-native": "0.59.8"
},

React Native version mismatch. normally occurs when I'm running other React native version and I don't close my terminal or clean my project that error, this is described in many starckoverflow questions,
Version mismatch questions related
https://stackoverflow.com/questions/50234014/react-native-version-mismatch-native-0-54-4-and-javascript-0-52 .
https://stackoverflow.com/questions/47763824/react-native-version-mismatch

FATAL EXCEPTION: mqt_native_modules the question related is this and the suggestion is downgrade
https://stackoverflow.com/questions/47769671/android-google-play-fatal-exception-mqt-native-modules-with-react-native-app-on

this is not the case because I already generate a build and I'm not running the terminal, so my assumption is there is and new jsc-android update and also RN .60.0 and for some reason is taking the latest one and not the version number,

I held the RN version and force to use 0.59.8 because we are using a lot of RN dependencies and not all of those are ready to migrate to Android X

Reference holding RN
instead of using 'com.facebook.react:react-native:+'
implementation ('com.facebook.react:react-native:0.59.8'){
force = true
}

package.json
instead of using '^16.8.6' and '^0.59.8'
"react": "16.8.6",
"react-native": "0.59.8",

I'm wondering if I'm missing something or what version of Javascript core should be right for my case, and this is what the javascript log

D/JavaScriptCore.Version: 241213.2.0

Describe what you expected to happen:

the apps should not crash

Reproducible sample code

N/A

Please try to move these two maven repos before google() and jcenter()

android/build.gradle

        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            // Local Maven repo containing AARs with JSC library built for Android
            url "$rootDir/../node_modules/jsc-android/dist"
        }

        jcenter()
        google()

Thank you for your reply :), this did not work :( at the end I have to run this in order ro refresh index.android.bundle and src/main/res
, I'm not sure why
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res


commented

Thank you for your reply :), this did not work :( at the end I have to run this in order ro refresh index.android.bundle and src/main/res
, I'm not sure why
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

@janet-rivas what did you do to make it run after running "the command" you mentioned?
just react-native run-android?