Our project has for some time now included a custom .jar file. This includes an R.java file that defines a number of utf-8 strings (Chinese etc).
We recently tried to upgrade to the latest version of the prime31 SocialNetwork plugin, which makes use of Android Library projects to separate the resources out from the primary project’s.
The build now fails with the following message:
“Failed to recompile android resource files. See the console for details”
The console contains two almost-identical messages that look like the following (with minor editing):
Build failed: Error building Player: CommandInvokationFailure: Failed to recompile android resource files. See the Console for details.
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/javac -bootclasspath "/Users/me/Documents/adt-bundle-mac-x86_64-20130522/sdk/platforms/android-19/android.jar" -d "/Users/me/Documents/project/Temp/StagingArea/bin/classes" -source 1.6 -target 1.6 -encoding ascii "com/blah/R.java" "com/facebook/android/R.java"
stderr[
com/blah/R.java:1725: unmappable character for encoding ascii
/** <string name="blah">??????????????????</string>
^
A couple of things to note here. First, the file that it’s complaining about is in our own library: the one that has been working fine for months. Second, the command being run explicitly specifies “-encoding ascii”.
Now, if I go to the /Users/me/Documents/project/Temp/StagingArea/gen directory, and run the command in the error message, I reproduce the same error. But if I drop the -encoding switch, the error goes away, and compilation succeeds.
I can’t find anything in my project that forces ascii encoding anywhere (tried a recursive case-insensitive grep) . I’ve tried adding as much as I can to force utf-8 encoding (e.g. project.properties files), but either that doesn’t work, or I’m not doing it in the right place. I’ve tried forcing it within the prime31 project too, to no avail.
The fact that this is failing on our library, but only when using a 3rd-party library project suggests to me that this is happening in an additional step that doesn’t take place unless library projects are being used, and it is this additional step that is forcing the ascii encoding. That being the case, this looks like a unity bug to me, but would appreciate suggestions for other things I could try to resolve the issue.
Thanks!