[Mono-bugs] [Bug 670839] New: Building a Java file fails when encoding is not ANSI

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Feb 9 23:14:29 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=670839

https://bugzilla.novell.com/show_bug.cgi?id=670839#c0


           Summary: Building a Java file fails when encoding is not ANSI
    Classification: Mono
           Product: MonoDroid
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Tools
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: gshackles at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Description of Problem:

If you set a UTF-8 encoded file to AndroidJavaSource, the build will fail with
this error:

---

  C:\Program Files (x86)\MSBuild\Novell\monodroid.exe -v --nosign
--sdk-dir="C:\android-sdk-windows" --builddir="C:\Users\Greg\Documents\Visual
Studio
2010\Projects\MonoDroidApplication21\MonoDroidApplication21\obj\Debug\android"
--framework-dir="C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\MonoDroid\v2.2" --framework-dir="C:\Program
Files (x86)\Reference Assemblies\Microsoft\Framework\MonoDroid\v1.0"
-S="C:\Users\Greg\Documents\Visual Studio
2010\Projects\MonoDroidApplication21\MonoDroidApplication21\obj\Debug\res"
--package="monodroidapplication21.monodroidapplication21" -v=10 --nolink
--abi="armeabi" --java-sdk-dir="C:\Program Files (x86)\Java\jdk1.6.0_21"
--debug --sdk-platform="8" -js="Bar.java" -js="Foo.java" -js="Baz.java"
"C:\Users\Greg\Documents\Visual Studio
2010\Projects\MonoDroidApplication21\MonoDroidApplication21\bin\Debug\MonoDroidApplication21.dll"
"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\MonoDroid\v2.2\Mono.Android.dll" "C:\Program
Files (x86)\Reference
Assemblies\Microsoft\Framework\MonoDroid\v1.0\mscorlib.dll" "C:\Program Files
(x86)\Reference Assemblies\Microsoft\Framework\MonoDroid\v1.0\System.Core.dll"
"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\MonoDroid\v1.0\System.dll" "C:\Program Files
(x86)\Reference Assemblies\Microsoft\Framework\MonoDroid\v1.0\System.Xml.dll"
"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\MonoDroid\v1.0\System.Xml.Linq.dll" 
  MonoDroid.Utils.CommandFailedException: Operation is not valid due to the
current state of the object.
     at
MonoDroid.Utils.ProcessRocks.<ReadStandardOutput>c__Iterator4.MoveNext()
     at Monodroid.Toolbox.InvokeCommand(IEnumerable`1 commandLine)
     at Monodroid.Toolbox.InvokeJavac(String src_path)
     at Monodroid.Droidinator.CreateDalvikBytecode(List`1 javaTypes, List`1
assemblies)
     at Monodroid.Droidinator.CreateApk()
     at Monodroid.MainClass.Main(String[] argv)
  C:\Users\Greg\Documents\Visual Studio
2010\Projects\MonoDroidApplication21\MonoDroidApplication21\Baz.java:1: illegal
character: \187
     ^
  C:\Users\Greg\Documents\Visual Studio
2010\Projects\MonoDroidApplication21\MonoDroidApplication21\Baz.java:1: illegal
character: \191
      ^


---

If I convert the file to ANSI it builds correctly. Is there any way to handle
this automatically? It looks like (at least in Visual Studio) that Add->Text
File creates a UTF-8 encoded file, whereas Add->Class creates an ANSI encoded
file. If there's no graceful way to handle it, maybe it's worth adding a Java
Source item type to the dialog to make it more straightforward to create it
with the correct encoding?

Steps to reproduce the problem:
1. Add a new text file to the project named Foo.java
2. Set its build action to AndroidJavaSource
3. Build


Actual Results:

Build breaks with the above error


Expected Results:

Build should succeed


How often does this happen? 

Every time

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list