Flutter Firebase Remote Config No virtual method isDeveloperModeEnabled()Z in class .../FirebaseRemoteConfigSettings
Asked Answered
T

3

6

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'
    }
}
Tertia answered 3/11, 2020 at 16:18 Comment(0)
L
6

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

Lavenialaver answered 2/12, 2020 at 13:34 Comment(1)
Yeah, I actually forgot about this additional steps I've done, here is +1 for your effort posting it hereClangor
C
1

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

Clangor answered 5/11, 2020 at 13:43 Comment(6)
How exactly did you find MethodCallHandler file ? i been looking for it the whole day on my mac with no luckLavenialaver
@Lavenialaver go to folder, where you installed flutter, here is hidden folder .pub-cache. Or if you are using IntelliJ you can easily find it under External Libraries -> Flutter Plugins in project navigatorClangor
Thank you, i found it and i did the update but same issue, is there any additional steps to this change?Lavenialaver
@DimaRostopira I don't have the MethodCallHandler.java file directly inside the hidden .pub-cache folder. If I then go to the hosted/pub.dartlang.org/firebase_remote_config-0.4.2/android/src/main/java/io/flutter/firebase/firebaseremoteconfig folder I found a MethodCallHandlerImpl.java file. It doesn't have the suggested FirebaseRemoteConfig.getInstance().setDefaults(defaults); to change.. Is it the wrong file?Saga
@Saga try adding implementation platform('com.google.firebase:firebase-bom') to your build gradleClangor
@DimaRostopira indeed, changing implementation platform('com.google.firebase:firebase-bom:26.4.0') to implementation platform('com.google.firebase:firebase-bom') worked, without touching the java file.Saga
O
0

Remove this code in your android app's build gradle if it is set:

rootProject.ext {
    set('FlutterFire', [
            FirebaseSDKVersion: '26.1.1'
    ])
}
Organic answered 2/1, 2021 at 9:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.