Status Update
Comments
xa...@android.com <xa...@android.com> #2
I don't think this is related to Gradle itself. This is how Android handles resources.
Adam, do you have an idea of what's going on here?
Adam, do you have an idea of what's going on here?
ge...@gmail.com <ge...@gmail.com> #3
It seems the way Android handles the resources of type <item type=string> is flawed.
If gradle resValue generated the String resources using <string> tag instead of <item type=string> this would not be happening.
BTW, i don't see much advantage on using generic <item> tag in this case.
If gradle resValue generated the String resources using <string> tag instead of <item type=string> this would not be happening.
BTW, i don't see much advantage on using generic <item> tag in this case.
xa...@android.com <xa...@android.com> #4
ah it's interesting that <string> would be different from <item type=string>!
I'll talk to Adam to see what's up.
I'll talk to Adam to see what's up.
si...@gmail.com <si...@gmail.com> #6
Wow, when it will be fixed?)
sc...@gmail.com <sc...@gmail.com> #7
ARG! Can I have the last day of my life back please????
xa...@android.com <xa...@android.com>
[Deleted User] <[Deleted User]> #8
i encounter this problem, too. :(
je...@google.com <je...@google.com> #9
Released in 1.3.0-beta3 or earlier.
[Deleted User] <[Deleted User]> #10
Is there a solution for this? I am facing the same issue: my string gets outputted as 'fxasd7a' instead of 'mystring'.
Description
Host OS: Windows 7 Ultimate 64-bit
SDK tools version: 23.0.5
Android Studio version: 0.8.14
Android gradle plugn: com.android.tools.build:gradle:0.13.3
STEPS TO REPRODUCE:
1. Add to build.gradle
android {
compileSdkVersion 21
buildToolsVersion '21.0.2'
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
}
buildTypes {
debug {
resValue "string", "NOTQUOTED", "ABC"
resValue "string", "QUOTED", "\"ABC\""
resValue "string", "DOUBLEQUOTED", "\"\"ABC\"\""
resValue "string", "FAIL", "4294967296"/*This number is 0x100000000*/
resValue "string", "FAILFIX", "\"4294967296\""
}
}
}
2. Note the quotes on the generated resources (all of type string)
<!-- Values from build type: debug -->
<item name="NOTQUOTED" type="string">ABC</item>
<item name="QUOTED" type="string">"ABC"</item>
<item name="DOUBLEQUOTED" type="string">""ABC""</item>
<item name="FAIL" type="string">4294967296</item>
<item name="FAILFIX" type="string">"4294967296"</item>
3. Read the values procedurally
Log.d("","NOTQUOTED is "+getString(R.string.NOTQUOTED));
Log.d("","QUOTED "+getString(R.string.QUOTED));
Log.d("","DOUBLEQUOTED is "+getString(R.string.DOUBLEQUOTED));
Log.d("","FAIL is "+getString(R.string.FAIL));
Log.d("","FAILFIX is "+getString(R.string.FAILFIX));
OBSERVED RESULTS, Note the output ZERO for R.string.FAIL:
D/﹕ NOTQUOTED is ABC
D/﹕ QUOTED ABC
D/﹕ DOUBLEQUOTED is ABC
D/﹕ FAIL is 0
D/﹕ FAILFIX is 4294967296
EXPECTED RESULTS, As all items are of type string:
D/﹕ NOTQUOTED is ABC
D/﹕ QUOTED ABC
D/﹕ DOUBLEQUOTED is ABC
D/﹕ FAIL is 4294967296
D/﹕ FAILFIX is 4294967296
ADDITIONAL INFORMATION 1:
Even if the "@string/FAIL" item is referenced in a meta-data inside AndroidManifest, the wrong value ZERO is picked.
ADDITIONAL INFORMATION 2:
When adding the resources manually as <string> to resources:
<string name="DOUBLEQUOTED">""ABC""</string>
<string name="FAIL">4294967296</string>
<string name="FAILFIX">"4294967296"</string>
<string name="NOTQUOTED">ABC</string>
<string name="QUOTED">"ABC"</string>
The observed results are the expected results
D/﹕ NOTQUOTED is ABC
D/﹕ QUOTED ABC
D/﹕ DOUBLEQUOTED is ABC
D/﹕ FAIL is 4294967296
D/﹕ FAILFIX is 4294967296