i have the following remote config_default.xml file
我有以下远程config_default.xml文件
<?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 Firebase remote config getString()
method, i always get the string without quotes
现在当我尝试使用Firebase远程配置getString()方法访问它时,我总是得到没有引号的字符串
"[{title:TitleA,path:pathA,image_url: Some URL A},{title:TitleB,path:pathB,image_url: Some URL B}]"§
as seen in the image below
如下图所示
I put the same String on Firebase remote config console and once the app fetches it from there it places the double quotes in the string like i expect it.
我在Firebase远程配置控制台上放了相同的字符串,一旦应用程序从那里取出它,就会将双引号放在字符串中,就像我期望的那样。
I double checked this and it seems to be working fine when i use the following project gradle file
我仔细检查了这个,当我使用以下项目gradle文件时它似乎工作正常
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 the gradle to use new versions for all libraries The quotes seemed to be ignored only then. My new project gradle file
但是当我更新gradle以使用所有库的新版本时,引号似乎只会被忽略。我的新项目gradle文件
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 of the library is causing this to happen but it would be great if someone could point it out.
我不知道哪个库会导致这种情况发生,但如果有人能指出它会很棒。
3 个解决方案
#1
2
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.
这个问题出现是因为firebase在Map中转换你的xml时有一个bug,为了解决这个问题,你可以使用MAP而不是xml。
sample:
样品:
firebaseConfig.setDefaults(Map<String, Object>);
firebaseConfig.setDefaults(Map
This change will solve your problem with double quotes.
此更改将使用双引号解决您的问题。
#2
1
I sent this issue to the firebase help team and got the following response:
我将此问题发送给firebase帮助团队并得到以下响应:
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.
看起来Gradle工具版本3.0.1存在问题。临时解决方法是使用Gradle工具版本2.3.3。
In the project level build.gradle
file:
在项目级build.gradle文件中:
Replace classpath 'com.android.tools.build:gradle:3.0.1'
with
用class替换classpath'com.android.tools.build:grad:3.0.1'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath'com.android.tools.build:grad:2.3.3'
and
和
Relpace google()
with
Relpace google()用
maven {
url 'https://maven.google.com'
}
#3
0
There are multiple solutions for this problem
1. Use firebaseConfig.setDefaults(Map); for setting up the default configuration.
1.使用firebaseConfig.setDefaults(Map);用于设置默认配置。
2. Use backslash (\) before Double Quotes(") in your String in .xml file.
2.在.xml文件中的String中的Double Quotes(“)之前使用反斜杠(\)。
3. Replace classpath 'com.android.tools.build:gradle:3.0.1' with
3.将classpath'com.android.tools.build:gradle:3.0.1'替换为
*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
4.在gradle.properties中添加android.enableAapt2 = false
#1
2
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.
这个问题出现是因为firebase在Map中转换你的xml时有一个bug,为了解决这个问题,你可以使用MAP而不是xml。
sample:
样品:
firebaseConfig.setDefaults(Map<String, Object>);
firebaseConfig.setDefaults(Map
This change will solve your problem with double quotes.
此更改将使用双引号解决您的问题。
#2
1
I sent this issue to the firebase help team and got the following response:
我将此问题发送给firebase帮助团队并得到以下响应:
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.
看起来Gradle工具版本3.0.1存在问题。临时解决方法是使用Gradle工具版本2.3.3。
In the project level build.gradle
file:
在项目级build.gradle文件中:
Replace classpath 'com.android.tools.build:gradle:3.0.1'
with
用class替换classpath'com.android.tools.build:grad:3.0.1'
classpath 'com.android.tools.build:gradle:2.3.3'
classpath'com.android.tools.build:grad:2.3.3'
and
和
Relpace google()
with
Relpace google()用
maven {
url 'https://maven.google.com'
}
#3
0
There are multiple solutions for this problem
1. Use firebaseConfig.setDefaults(Map); for setting up the default configuration.
1.使用firebaseConfig.setDefaults(Map);用于设置默认配置。
2. Use backslash (\) before Double Quotes(") in your String in .xml file.
2.在.xml文件中的String中的Double Quotes(“)之前使用反斜杠(\)。
3. Replace classpath 'com.android.tools.build:gradle:3.0.1' with
3.将classpath'com.android.tools.build:gradle:3.0.1'替换为
*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
4.在gradle.properties中添加android.enableAapt2 = false