invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.71k stars 2.22k forks source link

[πŸ›] Android Fatal Exception: java.lang.NoSuchFieldError: No field LOCK of type Ljava/lang/Object πŸ”₯ #4537

Closed jocoders closed 4 years ago

jocoders commented 4 years ago

Issue

Get the error only on Android 8 in the production mode from crashlytics. In the develop mode it is not possible to catch it. From the stacktrace it is clear the error is happening in Java side. NoSuchFieldError occurs if the application tries to access or modify the specified field of an object and that object no longer has that field.

Project Files

error stacktrace:

Fatal Exception: java.lang.NoSuchFieldError: No field LOCK of type Ljava/lang/Object; in class Lcom/google/firebase/FirebaseApp; or its superclasses (declaration of 'com.google.firebase.FirebaseApp' appears in base.apk:classes2.dex)
       at com.google.firebase.FirebaseApp.access$300(com.google.firebase:firebase-common@@19.2.0:89)
       at com.google.firebase.FirebaseApp$GlobalBackgroundStateListener.onBackgroundStateChanged(com.google.firebase:firebase-common@@19.2.0:661)
       at com.google.android.gms.common.api.internal.BackgroundDetector.onBackgroundStateChanged(:45)
       at com.google.android.gms.common.api.internal.BackgroundDetector.onTrimMemory(:41)
       at android.app.Application.onTrimMemory(Application.java:160)
       at android.app.ActivityThread.handleTrimMemory(ActivityThread.java:5613)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1906)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6944)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

Javascript

Click To Expand

#### `package.json`: ``` { "devDependencies": { "@babel/core": "^7.7.7", "@babel/plugin-proposal-decorators": "^7.7.4", "@babel/plugin-transform-runtime": "^7.7.6", "@babel/runtime": "^7.7.7", "@types/color": "^3.0.0", "@types/crypto-js": "^3.1.43", "@types/currency-formatter": "^1.3.0", "@types/hoist-non-react-statics": "^3.3.1", "@types/lodash": "^4.14.149", "@types/react": "^16.9.35", "@types/react-native": "^0.60.31", "@types/react-native-fabric": "^0.5.0", "@types/react-native-modal-dropdown": "^0.7.0", "@types/react-native-push-notification": "^3.0.7", "@types/react-native-snap-carousel": "^3.8.1", "@types/react-native-view-pdf": "^0.8.0", "@types/relaxed-json": "^1.0.0", "@types/shortid": "0.0.29", "@types/stacktrace-js": "^2.0.3", "@types/url-parse": "^1.4.3", "@types/validator": "^12.0.1", "babel-plugin-module-resolver": "^4.0.0", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "babel-preset-react-native": "^4.0.1", "babel-traverse": "^6.26.0", "eslint": "^7.9.0", "firebase-tools": "^7.11.0", "husky": "^3.1.0", "metro-config": "^0.63.0", "metro-react-native-babel-preset": "^0.58.0", "metro-react-native-babel-transformer": "^0.63.0", "patch-package": "^6.2.2", "react-native-svg-transformer": "^0.14.3", "react-native-typescript-transformer": "^1.2.12", "reactotron-react-native": "^4.0.2", "schedule": "^0.5.0", "tslib": "^2.0.1", "typescript": "^4.0.2" }, "dependencies": { "@react-native-community/blur": "^3.4.1", "@react-native-community/datetimepicker": "2.6.0", "@react-native-community/picker": "^1.6.6", "@react-native-community/push-notification-ios": "^1.0.3", "@react-native-firebase/app": "^6.2.0", "@react-native-firebase/remote-config": "^6.2.0", "@types/semver-compare": "^1.0.1", "color": "^3.1.2", "country-telephone-data": "^0.6.0", "crypto-js": "^3.1.9-1", "currency-formatter": "^1.5.4", "hoist-non-react-statics": "^3.3.1", "inversify": "^5.0.1", "jsc-android": "^245459.0.0", "keymirror": "^0.1.1", "lodash": "^4.17.11", "mobx": "^5.15.6", "mobx-react": "^6.1.1", "mobx-utils": "^5.6.1", "moment": "^2.23.0", "react": "16.11.0", "react-native": "0.62.0", "react-native-appsflyer": "^1.4.7", "react-native-camera": "^3.39.0", "react-native-cancelable-fetch": "^0.1.1", "react-native-check-box": "^2.1.7", "react-native-collapsible": "^1.4.0", "react-native-default-preference": "^1.3.2", "react-native-device-info": "^5.4.0", "react-native-email": "^1.0.2", "react-native-extended-stylesheet": "^0.12.0", "react-native-fast-image": "^7.0.2", "react-native-gesture-handler": "^1.5.2", "react-native-get-random-values": "^1.5.0", "react-native-hyperlink": "0.0.19", "react-native-image-to-pdf": "^1.2.0", "react-native-input-scroll-view": "^1.9.3", "react-native-linear-gradient": "^2.5.6", "react-native-markdown-display": "^6.1.6", "react-native-masked-text": "^1.12.3", "react-native-modal": "^11.5.6", "react-native-modal-wrapper": "^3.1.1", "react-native-orientation-locker": "^1.1.8", "react-native-phone-call": "^1.0.9", "react-native-rate": "^1.1.3", "react-native-reanimated": "^1.13.1", "react-native-restart": "0.0.13", "react-native-screens": "^2.0.0-alpha.22", "react-native-slider": "^0.11.0", "react-native-snap-carousel": "^3.9.1", "react-native-svg": "^9.13.6", "react-native-tab-view": "^2.11.0", "react-native-vector-icons": "^6.6.0", "react-native-view-pdf": "^0.10.1", "react-native-webview": "^9.2.2", "react-navigation": "^4.0.10", "react-navigation-stack": "^1.10.3", "react-navigation-tabs": "^2.6.2", "reflect-metadata": "^0.1.13", "relaxed-json": "^1.0.3", "ringbufferjs": "^1.1.0", "rn-content-loader": "0.0.6", "rn-fetch-blob": "^0.12.0", "rn-tooltip": "^2.0.0", "rxjs": "^6.5.2", "semver-compare": "^1.0.0", "shortid": "^2.2.14", "stacktrace-js": "^2.0.0", "url-join": "^4.0.0", "url-parse": "^1.4.7", "uuid": "^8.3.0", "validator": "^12.1.0", }, "importSort": { ".js, .jsx, .es6, .es": { "parser": "babylon" }, ".ts, .tsx": { "parser": "typescript", "style": "module-scoped" } }, "husky": { "hooks": { "pre-push": "npm run lint", "pre-commit": ".githooks/lint-staged.sh" } } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # N/A ``` #### `AppDelegate.m`: ```objc // N/A ```


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ``` buildscript { repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:3.4.2") classpath 'com.google.gms:google-services:4.2.0' } } allprojects { repositories { google() mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } google() jcenter() maven { url "https://www.jitpack.io" } } } ext { compileSdkVersion = 29 buildToolsVersion = "29.0.0" minSdkVersion = 21 targetSdkVersion = 29 googlePlayServicesVersion = "16.+" firebaseVersion = "17.3.4" firebaseMessagingVersion = "20.2.1" } subprojects { subproject -> afterEvaluate{ if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion } } } } ``` #### `android/app/build.gradle`: ``` ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` OUTPUT GOES HERE ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [x] Android - [] **iOS** but have not tested behavior on Android - [] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 6.2.0` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y` & `4.0.2`


mikehardy commented 4 years ago

Hi there! Your versions of react-native-firebase (and thus firebase-android-sdk underlying library) are tremendously out of date, please update to current stable versions and attempt to reproduce. We can reopen if this occurs with current versions