java.lang.NoSuchFieldError:
at com.google.android.gms.flags.FlagValueProvider.initialize (Unknown Source)
at com.google.android.gms.flags.FlagRegistry.initialize (Unknown Source)
at com.google.firebase.auth.internal.zzx.initialize (Unknown Source)
at com.google.firebase.auth.internal.zzt.run (Unknown Source)
at android.os.Handler.handleCallback (Handler.java:815)
at android.os.Handler.dispatchMessage (Handler.java:104)
at android.os.Looper.loop (Looper.java:207)
at android.os.HandlerThread.run (HandlerThread.java:61)
Application Target Platform:
Android
Development Operating System:
macOS Sierra
Build Tools:
React Native
version:
0.55.4
React Native Firebase
Version:
4.3.8
Firebase
Module:
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-firestore:17.0.2'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation "com.google.firebase:firebase-invites:16.0.1"
implementation "com.google.firebase:firebase-analytics:16.0.1"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // enable badge on icon app
implementation 'com.google.android.gms:play-services-auth:15.0.1'
typescript
?Loving react-native-firebase
? Please consider supporting them with any of the below:
React Native Firebase
and Invertase
on TwitterHaving the same issue on the old code. My stacktrace is
Fatal Exception: java.lang.NoSuchFieldError: No static field PREFER_HIGHEST_OR_REMOTE_VERSION_NO_FORCE_STAGING of type Lcom/google/android/gms/dynamite/DynamiteModule$VersionPolicy; in class Lcom/google/android/gms/dynamite/DynamiteModule; or its superclasses (declaration of 'com.google.android.gms.dynamite.DynamiteModule' appears in /data/app/it.habitify.android.debug-1/base.apk:classes2.dex)
at com.google.android.gms.flags.FlagValueProvider.initialize(Unknown Source)
at com.google.android.gms.flags.FlagRegistry.initialize(Unknown Source)
at com.google.firebase.auth.internal.zzx.initialize(Unknown Source)
at com.google.firebase.auth.internal.zzt.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.os.HandlerThread.run(HandlerThread.java:61)
It reproduces 100% on "fresh" app login, so first logout, kill app, then login. It doesn't break on the released version of my app though...
Can you try updating your gms
/play-services
dependencies to 16.0.1
(up from 15.0.1
) in your build gradle? Let me know if that sorts it so I can update the library.
Loving react-native-firebase
and the support we provide? Please consider supporting us with any of the below:
React Native Firebase
and Invertase
on Twitter Any updates on this?
Hello together,
I had the same issue, but I wasn't really sure how to reproduce it. It popped up at 80% of the time, when logging in after a clean install of the app.
After updating the dependencies to the following, I was no longer able to reproduce the bug. I can not guarantee, that it's gone completely, but as I said, I wasn't able to reproduce it anymore.
Here's my dependencies:
/android/build.gradle
buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.25.1'
}
}
/android/app/build.gradle
dependencies {
implementation(project(':react-native-firebase')) {
transitive = false
}
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation "com.google.firebase:firebase-core:16.0.4"
implementation "com.google.firebase:firebase-analytics:16.0.4"
implementation "com.google.firebase:firebase-auth:16.0.4"
implementation "com.google.firebase:firebase-database:16.0.3"
implementation "com.google.firebase:firebase-messaging:17.3.3"
implementation "com.google.firebase:firebase-storage:16.0.3"
implementation "com.google.firebase:firebase-config:16.0.1"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
}
We had the same issue last week. Here is what was going on:
On build, the google play services gradle plugin chose the google play services version 16. I guess firebase 15.x is not compatible with play services 16.x...
After updating firebase to version 16 we didn't have the error any more.
To see which version of play services you have just execute: ./gradlew :app:dependencies
and look at the dependencies tree.
@Salakar I upgraded react-native-firebase to 5.0.x
and react-native to 0.56.1
and the problem persisted until they changed the google-play-services version from 15.x
to 16.x
implementation 'com.google.android.gms:play-services-base:16.0.1' //upgraded
implementation 'com.google.android.gms:play-services-auth:16.0.1' //upgraded
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'com.google.firebase:firebase-storage:16.0.2'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-firestore:17.1.0'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-invites:16.0.3'
implementation "com.google.firebase:firebase-analytics:16.0.1"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
What I did to resolve the issue.
I was upgrading all the libraries (react-native, react, firebase etc) and I found that some of them were using 15.X
and others 16.X
version of com.google.android.gms:play-services-base
as @jcsena suggested. For me I had to upgrade for even newer google deps. I found that all latest patches (not majors as I'd expect) depend on play services v16 already. Here's my build.gradle
excerpt:
implementation "com.google.firebase:firebase-core:16.0.4"
implementation "com.google.firebase:firebase-auth:16.0.4"
implementation "com.google.firebase:firebase-database:16.0.3"
implementation "com.google.firebase:firebase-messaging:17.3.2"
implementation "com.google.firebase:firebase-firestore:17.1.1"
Latest Google dependencies available here: https://firebase.google.com/support/release-notes/android#latest_sdk_versions
And package.json
"react": "16.5.1",
"react-native": "^0.57.2",
"react-native-firebase": "^5.0.0",
"react-native-google-signin": "^1.0.0-rc6",
As suggested by @rumpl use ./gradlew :app:dependencies
to inspect which libraries still use v15.
The important thing is to update the play-service dependencies to at least 16.0.1.
Just to clarify:
You do not have to update react-native-firebase to 5.X.X version (I'm still using 4.3.8 and it is working).
Also, you MUST update the dependencies to at least those specified by damienix.
Ok, hi everyone, had exactly the same problem. So the solution was as follows.
The project had been on RN0.55 - had to migrate to 0.57 and do the following:
in android/build.gradle file
dependencies {
...
classpath 'com.google.gms:google-services:4.1.0' // google-services plugin
...
}
...
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
in android/app/build.gradle
dependencies {
...
implementation "com.google.firebase:firebase-core:16.0.4"
implementation "com.google.android.gms:play-services-base:16.0.1"
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation "com.google.firebase:firebase-auth:16.0.4"
implementation "com.google.firebase:firebase-database:16.0.3"
implementation "com.google.firebase:firebase-storage:16.0.3"
implementation "com.google.firebase:firebase-config:16.0.1"
...
}
:react-native-firebase should be compiled with transitive = false
as rumpl suggested - running ./gradlew :app:dependencies
helped investigating a lot.
I can't say the problem was solved, but i cannot reproduce it anymore.
Hey all, these are the versions being used in v5.1.0 by default, if you want to try v5.1.0 early then check out [email protected]
- see the rc1
release notes on GitHub releases for the correct Native SDK versions.
For rc1-rc2 changes see the commits comparison (I've yet to write up a changelog, need sleep, it's 5am 馃槴): https://github.com/invertase/react-native-firebase/compare/v5.1.0-rc1...v5.1.0-rc2
Thanks
Most helpful comment
@Salakar I upgraded react-native-firebase to
5.0.x
and react-native to0.56.1
and the problem persisted until they changed the google-play-services version from15.x
to16.x