ant is raising org.xml.sax.SAXParseException on android build

Tool versions:

  • Apache Ant(TM) version 1.9.6 compiled on June 29 2015
  • fuse 0.12.0 (build 6180)
  • Uno 0.27.4 (build 1983) OS X 10.11 i386 d39e46f

I’m getting this error:

BUILD FAILED
/Users/jskrzypek/dev/android-sdk-macosx/tools/ant/build.xml:407: org.xml.sax.SAXParseException: The value of attribute "android:label" associated with an element type "null" must not contain the '<' character.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:247)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:287)
    at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:459)
    at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:506)
    at com.android.ant.GetTypeTask.execute(GetTypeTask.java:85)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.Main.runBuild(Main.java:853)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
--------------- linked to ------------------
javax.xml.xpath.XPathExpressionException: org.xml.sax.SAXParseException: The value of attribute "android:label" associated with an element type "null" must not contain the '<' character.
    at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:464)
    at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:506)
    at com.android.ant.GetTypeTask.execute(GetTypeTask.java:85)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
(69.19s)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.Main.runBuild(Main.java:853)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)

Build completed in 115.83 seconds.
    9 Warning(s)
    1 Error(s)
Caused by: org.xml.sax.SAXParseException: The value of attribute "android:label" associated with an element type "null" must not contain the '<' character.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:247)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:287)
    at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:459)
    ... 18 more

Total time: 1 second
(unknown): E0200: Android build failed -- rerun with '-v' for more information
fuse: Errors were encountered while building the project

For reference here are the relevant parts of our index.unoproj:

{
  ...
  "Android": {
    "ApplicationLabel": "<%=appname%>",
    "Icons": {
      "LDPI": "./resources/android/drawable-ldpi/icon.png",
      "MDPI": "./resources/android/drawable-mdpi/icon.png",
      "HDPI": "./resources/android/drawable-hdpi/icon.png",
      "XHDPI": "./resources/android/drawable-xhdpi/icon.png",
      "XXHDPI": "./resources/android/drawable-xxhdpi/icon.png",
      "XXXHDPI": "./resources/android/drawable-xxxhdpi/icon.png"
    },
    "GooglePlay": {
      "SenderID": "61316890949"
    },
    "NDK": {
      "PlatformVersion": 9
    },
    "SDK": {
      "BuildToolsVersion": "23.0.0",
      "CompileVersion": 21,
      "MinVersion": 10,
      "TargetVersion": 21
    }
  },
  "iOS": {
    ...
  },
  "Packages": [
        "Fuse.Animations",
        "Fuse.BasicTheme",
        "Fuse.Themes",
        "Fuse.Controls",
        "Fuse.Designer",
        "Fuse.Drawing",
        "Fuse.Drawing.Primitives",
        "Fuse.Effects",
        "Fuse.Elements",
        "Fuse.Entities",
        "Fuse.Gestures",
        "Fuse.Navigation",
        "Fuse.Shapes",
        "Fuse.Triggers",
        "Fuse.Reactive",
        "Fuse.Android",
        "Fuse.Desktop",
        "Fuse.iOS",
        "Fuse.Scripting",
        "FuseCore",
        "Uno.Collections",
        "Uno.Geometry",
        "Fuse.PushNotifications",
        "Experimental.iOS",
        "Fuse.UserEvents"
  ],
  "Includes": [
    "*"
  ]
}

Hah! Power of posting, I fixed it 30 seconds later :stuck_out_tongue:

Turns out the ApplicationLabel in our index.unoproj never got templated in by our code generator… :headdesk:

Simply replacing the "<%=appname%>" above with a plain string of our app name got rid of the error.