I have recently upgraded all my firebase libraries in my Flutter project. After that I'm getting the message:
/flutter (27126): [ERROR:flutter/shell/platform/android/platform_view_android_jni_impl.cc(43)] java.lang.NoSuchMethodError: No virtual method isDeveloperModeEnabled()Z in class Lcom/google/firebase/remoteconfig/FirebaseRemoteConfigSettings; or its super classes (declaration of 'com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings' appears in /data/app/package_name-1UBO7FEPHLsC2_eb7itJLA==/base.apk!classes3.dex)
After that my app crashes with the error:
[FATAL:flutter/shell/platform/android/platform_view_android_jni_impl.cc(942)] Check failed: CheckException(env).
Currently I'm using:
firebase_remote_config: ^0.4.0+2
firebase_core: 0.5.0+1
My dependencies in the android/build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4'
classpath 'io.fabric.tools:gradle:1.28.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
}
android/app/build.gradle
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.firebase:firebase-config:20.0.0'
implementation 'com.facebook.android:facebook-login:7.1.0'
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.google.android.gms:play-services-basement:17.5.0'
configurations.all {
resolutionStrategy.force 'com.google.android.gms:play-services-base:17.1.0'
}
}
Finally solved ..
Okey not only changing this line
properties.put("inDebugMode", firebaseRemoteConfigInfo.getConfigSettings().isDeveloperModeEnabled());
to
properties.put("inDebugMode", false);
& changing this
FirebaseRemoteConfigSettings settings = new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(debugMode).build();
firebaseRemoteConfig.setConfigSettings(settings);
to
FirebaseRemoteConfigSettings settings = new FirebaseRemoteConfigSettings.Builder().build();
firebaseRemoteConfig.setConfigSettingsAsync(settings);
You need also to change this
FirebaseRemoteConfig.getInstance().setDefaults(defaults);
to
FirebaseRemoteConfig.getInstance().setDefaultsAsync(defaults);
Still its an annoying issue and should be solved asap
It's a bug in plugin, see github issue for details: https://github.com/FirebaseExtended/flutterfire/issues/4035
Workaround: just add
implementation platform('com.google.firebase:firebase-bom')
To your build.gradle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With