使用antenna时候的问题

编译时找不到List.deleteAll这个方法,因为默认的的antenna使用cldc1.0。而这个deleteall是1.1的方法,解决方法是覆盖默认的cldc版本

<property name=”wtk.cldc.version” value=”1.1″/>

Antenna是用来构建j2me项目的ant任务 扩展。让整个构建过程变的很简单和易于管理。

附我使用的构建脚本供参考:

<?xml version=”1.0″?>

<project name=”MoFire” default=”build” basedir=”.”>

<!– Define the Wireless Toolkit home directory. Needed by the tasks. –>

<property name=”wtk.home” value=”D:developmentWTK2.5.2″/>
<property name=”wtk.cldc.version” value=”1.1″/>
<property name=”wtk.midp.version” value=”2.0″/>
<property name=”wtk.proguard.home” value=”D:developmentworkspaceMElibproguard4.1″/>

<!– Define some additional properties for this project. Not required. –>

<property name=”midlet.name” value=”${ant.project.name}”/>
<property name=”midlet.home” value=”.”/>
<property name=”midlet.vendor” value=”MoDoFo”/>
<property name=”midlet.version” value=”0.0.1″/>
<!– Define the tasks. –>

<taskdef resource=”antenna.properties” classpath=”lib/antenna-bin-1.0.0.jar”/>

<target name=”clean”>
<delete failonerror=”false” dir=”classes”/>
</target>

<target name=”dist” depends=”build”>
<mkdir dir=”dist/${midlet.name}-${midlet.version}” />
<property name=”distfolder” value=”dist/${midlet.name}-${midlet.version}”/>
<zip destfile=”${distfolder}/${midlet.name}-${midlet.version}-src.zip”>
<fileset dir=”src” includes=”**/*.*” />
<fileset dir=”res” includes=”**/*.*” />
</zip>
<copy file=”${midlet.name}.jad” todir=”${distfolder}” />
<copy file=”${midlet.name}.jar” todir=”${distfolder}” />
<copy file=”README.txt” todir=”${distfolder}” />

<wtkrun jadfile=”${distfolder}/${midlet.name}.jad” device=”DefaultColorPhone” wait=”true”/>
</target>

<target name=”build”>

<!– Make a JAD file from scratch, don’t copy the original one. –>

<wtkjad jadfile=”${midlet.name}.jad”
name=”${midlet.name}”
vendor=”${midlet.vendor}”
version=”${midlet.version}” >

<midlet name=”MoFire”
icon=”/logo.png”
class=”com.modofo.mofire.MoFire”/>
</wtkjad>

<mkdir dir=”classes”/>

<!– Compile everything, but don’t preverify (yet). –>

<wtkbuild srcdir=”${midlet.home}/src”
destdir=”classes”
preverify=”false”/>

<!– Package everything. Most of the necessary information is
contained in the JAD file. Also preverify the result this
time. To obfuscate everything, set the corresponding
parameter to “true” (requires RetroGuard or ProGuard). The
version parameter increments the MIDlet-Version by one. –>

<wtkpackage jarfile=”${midlet.name}.jar”
jadfile=”${midlet.name}.jad”
obfuscate=”false”
autoversion=”true”>

<!– Package our newly compiled classes and the
resources from the WTK’s demo application. –>

<fileset dir=”classes”/>
<fileset dir=”${midlet.home}/res”/>

</wtkpackage>

<!– Obfuscate. –>
<!– Not needed
<wtkobfuscate jarfile=”${midlet.name}.jar”
jadfile=”${midlet.name}.jad”/>
–>
<!– Preverify things, this time separately to test the
corresponding task. –>

<wtkpreverify jarfile=”${midlet.name}.jar”
jadfile=”${midlet.name}.jad”/>

<!– Convert the JAR file into a MIDP for PalmOS PRC file. –>
<!– Not supported in wtk anymore – Zhangv
<wtkmakeprc jadfile=”${midlet.name}.jad”
prcfile=”${midlet.name}.prc”/>
–>
<!– Start the MIDlet suite –>
<!– Not need
<wtkrun jadfile=”${midlet.name}.jad” device=”DefaultColorPhone” wait=”true”/>
–>
</target>
</project>

Comments are closed.