Re: Specify source file language in build.xml?

Jeffrey Walton <[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <CAH8yC8mtQohW0coKjYbL+29LHDBO9=d0zxxzChdig5CmYhMuqA@mail.gmail.com>
On Tue, Feb 17, 2015 at 3:17 PM, Earl Hood <[email protected]> wrote:
> On Tue, Feb 17, 2015 at 2:11 PM, Jeffrey Walton wrote:
>> I'm trying to build an Android project from the command line. I'm
>> getting an error during `ant release`. The error is unmappable
>> character for encoding UTF-8.
>
> Use the 'encoding' attribute to the <javac> task.

Thanks Eric.

It looks like build.xml brings in
$ANDROID_SDK_ROOT/tools/ant/build.xml, and Android's build.xml uses
{java.encoding}:

$ cat "$ANDROID_SDK_ROOT/tools/ant/build.xml" | grep -A 10 javac
    ...
            <javac encoding="${java.encoding}"
                    source="${java.source}" target="${java.target}"
                    debug="true" extdirs="" includeantruntime="false"
                    destdir="${out.classes.absolute.dir}"
                    bootclasspathref="project.target.class.path"
                    verbose="${verbose}"
                    classpathref="project.javac.classpath"
                    fork="${need.javac.fork}">
                <src path="${source.absolute.dir}" />
                <src path="${gen.absolute.dir}" />
                <compilerarg line="${java.compilerargs}" />
            </javac>

I tried adding the following to the project's build.xml (not Android's
build.xml), but with no joy. It results in same/similar errors:

  <project>
  ...
    <property name="java.encoding" value="ascii" />
  </project>

I also tried to add the following to the project's build.xml (not
Android's build.xml):

  <project>
  ...
     <javac encoding="ascii" />
  </project>

But it results in:

    build.xml:115: srcdir attribute must be set!

I know ASCII is probably wrong. I'm just trying to get a toehold on
the fix at the moment).

How, exactly, do I specify the 'encoding' attribute to the <javac> task?

Sorry to ask. I'm not sure where the delineation between Ant problems
and Android problems occurs (should I be asking on an Android list?).
And all of this is modulo the problem of me being inexperienced and
wondering why comments are not being ignored (ignoring comments would
make this a non-sequitur).

Jeff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.