1. Go to link

http://www.cnblogs.com/rosepotato/admin/Files.aspx to download the libs_javamail_jars.7z which contains activation.jar,additionnal.jar and mail.jar and java file Mail.7z.

2. put the activation.jar,additionnal.jar and mail.jar into libs directory.

3. copy

    <property name="jar.libs.dir" value="libs" />
    <property name="jar.libs.absolute.dir" location="${jar.libs.dir}" />
    <path id="classpath">
        <fileset dir="${jar.libs.absolute.dir}">
            <include name="activation.jar"/>
            <include name="additionnal.jar"/>
            <include name="mail.jar"/>
        </fileset>
    </path>

before the line

    <!-- version-tag: VERSION_TAG -->
    <import file="${sdk.dir}/tools/ant/uibuild.xml" />

 in build.xml.

4. put

    <!-- overwrite the compile target in uibuild.xml to include to external jars -->
    <target name="compile" depends="-build-setup, -pre-compile">
        <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}"
                fork="${need.javac.fork}">
                <src path="${source.absolute.dir}" />
                <classpath refid="classpath"/>
                <compilerarg line="${java.compilerargs}" />
        </javac>
    </target>

    <!-- overwrite the -dex target in uibuild.xml to include external jar files into the target dex file. -->
    <target name="-dex" depends="compile, -post-compile">
        <dex executable="${dx}"
                output="${intermediate.dex.file}"
                nolocals="@{nolocals}"
                verbose="${verbose}">
            <fileset dir="${jar.libs.absolute.dir}">
                 <include name="activation.jar"/>
                 <include name="additionnal.jar"/>
                 <include name="mail.jar"/>
            </fileset>
            <path path="${out.classes.absolute.dir}"/>
        </dex>
    </target>

after the line

    <!-- version-tag: VERSION_TAG -->
    <import file="${sdk.dir}/tools/ant/uibuild.xml" />

then, everything is ok.

posted on 2013-06-07 15:42  Rosepotato  阅读(378)  评论(0编辑  收藏  举报