Android: Firebase remoteConfig getString() method is removing quotes from string inside default.xml

后端 未结 4 2041
萌比男神i
萌比男神i 2021-02-19 04:56

i have the following remote config_default.xml file



       
         


        
相关标签:
4条回答
  • 2021-02-19 05:15

    If, at defaults xml file, you use triple-backslash as escape sequence, it works:

    {\\\"someKey\\\": \\\"someValue\\\"}

    Will produce {"someKey": "someValue"} as output of FirebaseRemoteConfig's getString() method.

    0 讨论(0)
  • 2021-02-19 05:16

    There are multiple solutions for this problem

    1. Use firebaseConfig.setDefaults(Map); for setting up the default configuration.

    2. Use backslash (\) before Double Quotes(") in your String in .xml file.

    3. Replace classpath 'com.android.tools.build:gradle:3.0.1' with

    *classpath 'com.android.tools.build:gradle:2.3.3'* 
    
    and Relpace google() with
    maven { url 'https://maven.google.com' }
    

    4. Add android.enableAapt2 = false in gradle.properties

    0 讨论(0)
  • 2021-02-19 05:17

    Hi Sheraz Ahmad Khilji first of all, I apologize for the English, I don't know how to write english very well.

    This problems occours because firebase has a bug when converting your xml in a Map, to contorn this problem, you can use a MAP instead of a xml.

    sample:

    firebaseConfig.setDefaults(Map<String, Object>);

    This change will solve your problem with double quotes.

    0 讨论(0)
  • 2021-02-19 05:17

    I sent this issue to the firebase help team and got the following response:

    This is actually a known issue on our end and our engineers are already working to fix the issue. I can't share any details or timeline when the fix be available, but please check our release notes for future updates.

    Looks like there is a problem with Gradle tools version 3.0.1. The temporary workaround would be to use Gradle tools version 2.3.3.

    In the project level build.gradle file:

    Replace classpath 'com.android.tools.build:gradle:3.0.1' with

    classpath 'com.android.tools.build:gradle:2.3.3'

    and

    Relpace google() with

    maven {
            url 'https://maven.google.com'
    }
    
    0 讨论(0)
提交回复
热议问题