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

I have the following remote config_default.xml file

<?xml version="1.0" encoding="utf-8"?> <defaultsMap> <entry> <key>LOCAL_JSON</key> <value>[{"title":"TitleA","path":"pathA","image_url":" Some URL A"},{"title":"TitleB","path":"pathB","image_url":" Some URL B"}]</value> </entry> </defaultsMap> 

Now when I try to access it using the Firebase remote method getString() , I always get the string without quotes

 "[{title:TitleA,path:pathA,image_url: Some URL A},{title:TitleB,path:pathB,image_url: Some URL B}]"ยง 

as the picture below

enter image description here

I put the same line in the Firebase remote console console and after the application retrieves it from it, it puts double quotes in the line as I expect.

I double checked this and it seems to work fine when I use the following gradle file project

  apply plugin: 'com.github.ben-manes.versions' buildscript { repositories { maven { url "http://dl.bintray.com/populov/maven" } jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'me.tatarka:gradle-retrolambda:3.6.1' classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0' classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.2.1' classpath 'com.google.gms:google-services:3.1.0' classpath 'com.google.firebase:firebase-plugins:1.0.5' } } allprojects { repositories { maven { url "http://dl.bintray.com/populov/maven" } maven { url "http://oss.sonatype.org/content/repositories/snapshots" } maven { url "https://jitpack.io" } jcenter() flatDir { dirs 'libs' } } } 

But when I update gradle to use new versions for all libraries, the quotes seemed to be ignored only then. My new gradle file project

 apply plugin: 'com.github.ben-manes.versions' buildscript { repositories { maven { url "http://dl.bintray.com/populov/maven" } jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0' classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.2.1' classpath 'com.google.gms:google-services:3.1.2' classpath ('com.google.firebase:firebase-plugins:1.0.5') } } allprojects { repositories { maven { url "http://dl.bintray.com/populov/maven" } maven { url "http://oss.sonatype.org/content/repositories/snapshots" } maven { url "https://jitpack.io" } jcenter() google() flatDir { dirs 'libs' } } } 

I donโ€™t know which library is causing this, but it would be great if anyone could point this out.

+7
android android-gradle firebase firebase-remote-config
source share
2 answers

Hi Sheraz Ahmad Khilji first of all, I apologize for the British, I do not know how to write well in English.

These problems occur because firebase has an error converting xml to Map, to deal with this problem, you can use MAP instead of xml.

Example:

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

This change will solve your double quote problem.

+1
source share

I sent this question to the firebase help team and received the following answer:

This is actually a known issue, and our engineers are already working to fix the problem. I cannot convey any details or deadlines for when this fix will be available, but please check out our release notes for future updates.

There seems to be a problem with Gradle tools version 3.0.1. The workaround will be temporary using Gradle tools version 2.3.3 .

At 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

Move google() with

 maven { url 'https://maven.google.com' } 
0
source share

All Articles