美文网首页
uiautomator ant build 引用第三方jar包

uiautomator ant build 引用第三方jar包

作者: 炫子_260f | 来源:发表于2020-05-13 11:03 被阅读0次

    使用 默认sdk的ant build

    参考: https://blog.51cto.com/techgogogo/1608441?source=drt

    项目目录结构:

    image.png

    添加okhttp

    打开unbuild.xml

    1、

    原:

    <!-- Compiles this project's .java files into .class files. -->
    
    <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}" />
    
            <compilerarg line="${java.compilerargs}" />
    
        </javac>
    
    </target>
    

    改成:

    <!-- Compiles this project's .java files into .class files. -->
    
    <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}" />
    
            <compilerarg line="${java.compilerargs}" />
    
            <classpath>
    
                    <fileset dir="${jar.libs.dir}" includes="*.jar"/>
    
            </classpath>
    
        </javac>
    
    </target>
    

    2、

    原:

    <!-- Converts this project's .class files into .dex files -->
    
    <target name="-dex" depends="compile, -post-compile">
    
        <dex executable="${dx}"
    
                output="${intermediate.dex.file}"
    
                nolocals="@{nolocals}"
    
                verbose="${verbose}">
    
            <path path="${out.classes.absolute.dir}"/>
    
        </dex>
    
    </target>
    

    改成:

    <!-- Converts this project's .class files into .dex files -->
    
    <target name="-dex" depends="compile, -post-compile">
    
        <dex executable="${dx}"
    
                output="${intermediate.dex.file}"
    
                nolocals="@{nolocals}"
    
                verbose="${verbose}">
    
            <fileset dir="${jar.libs.dir}" >
    
                <include name="okhttp-3.4.0.jar"/>
    
                <include name="okio-1.9.0.jar"/>
    
            </fileset>
    
            <path path="${out.classes.absolute.dir}"/>
    
        </dex>
    
    </target>
    

    注:要添加依赖的jar包

    相关文章

      网友评论

          本文标题:uiautomator ant build 引用第三方jar包

          本文链接:https://www.haomeiwen.com/subject/uezgnhtx.html