在Eclipse中的Andr​​oid项目创建的jar [英] Create jar for android project in eclipse

查看:155
本文介绍了在Eclipse中的Andr​​oid项目创建的jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好所有我怎样才能创建一个是使用Eclipse的Andr​​oid创造了我的项目的jar文件。我在这样做的项目 - >右键单击 - >导出 - >选择商 - > antbuilder - >确定的再经过这个过程的的build.xml 的意志创建。在bulid.xml我将创建新的构建。

  • 右键单击项目 - >属性 - >选择新建 - >给build.xml文件和你的项目的路径和preSS确定,新的构建器将创建
  • 现在,选择项目属性,preSS确定的建设者。
  • 现在,建立你的项目,你的罐子会在bin文件夹中创建。

我按照上面的过程,但我的罐子是不是在bin文件夹中找到。我可以看到创建我的build.xml和所有过程进行顺利,但仍不能创建罐子。任何一个可以告诉我,我该怎么办呢?

我的build.xml

< XML版本=1.0编码=UTF-8独立=无&GT?; < - 警告:Eclipse中自动生成的文件。               任何修改都将被覆盖。               要包括用户特定的构建文件在这里,只需创建一个在同一               用处理指令目录< eclipse.ant.import&GT?;               作为第一项,并再次导出构建文件。 - > <项目的basedir =。默认为建NAME =testtttttttttt>     <物业环境=ENV/>     <属性名=DEBUGLEVEL值=源,线,瓦尔/>     <属性名=目标值=1.6/>     <属性名=源值=1.6/>     <路径ID =Android的2.2.libraryclasspath>         < pathelement位置=C:/ Program Files文件(x86)的/Android/android-sdk/platforms/android-8/android.jar/>     < /路径>     <路径ID =com.android.ide.eclipse.adt.LIBRARIES.libraryclasspath/>     &其中;路径的id =testtttttttttt.classpath>         < pathelement位置=斌/班/>         <路径REFID =Android的2.2.libraryclasspath/>         <路径REFID =com.android.ide.eclipse.adt.LIBRARIES.libraryclasspath/>     < /路径>     <目标名称=初始化>         < MKDIR DIR =斌/班/>         <复制includeemptydirs =假todir =斌/班>             <文件集DIR =SRC>                 <** / * java的排除名称= />             < /文件集>         < /复制和GT;         <复制includeemptydirs =假todir =斌/班>             <文件集DIR =根与GT;                 <** / * java的排除名称= />             < /文件集>         < /复制和GT;     < /目标和GT;     <目标名称=干净>         <删除DIR =斌/班/>     < /目标和GT;     <目标取决于=干净NAME =cleanall/>     <目标取决于=集结子项目,建设项目NAME =打造/>     <目标名称=集结子项目/>     <目标取决于=初始化NAME =建设项目>         <回声消息=$ {ant.project.name} $ {ant.file}/>         < javac的调试=真正的DEBUGLEVEL =$ {} DEBUGLEVELDESTDIR =斌/班来源=$ {}源目标=$ {}目标>             < SRC路径=SRC/>             <类路径REFID =testtttttttttt.classpath/>         < / javac的>         < javac的调试=真正的DEBUGLEVEL =$ {} DEBUGLEVELDESTDIR =斌/班来源=$ {}源目标=$ {}目标>             < SRC路径=根/>             <类路径REFID =testtttttttttt.classpath/>         < / javac的>     < /目标和GT;     <目标描述=构建它引用该项目的所有项目的有用传播的变化。 NAME =集结refprojects/>     <目标描述=复制Eclipse编译罐子蚂蚁lib目录NAME =INIT月食编译>         <复制todir =$ {ant.library.dir}>             <文件集DIR =$ {} ECLIPSE_HOME / plugins中包括=org.eclipse.jdt.core _ *罐子。/>         < /复制和GT;         <解压DEST =$ {ant.library.dir}>             < patternset包括=jdtCompilerAdapter.jar/>             <文件集DIR =$ {} ECLIPSE_HOME / plugins中包括=org.eclipse.jdt.core _ *罐子。/>         < /解压缩>     < /目标和GT;     <目标描述=使用Eclipse编译器编译项目NAME =集结蚀编译>         <属性名=build.compiler值=org.eclipse.jdt.core.JDTCompilerAdapter/>         < antcall目标=构建/>     < /目标和GT; < /项目>

解决方案

在Eclipse中,选择项目,右键单击该项目,选择导出,从这个选择JAR。然后按照简单的向导,并给予目标要保存罐,并完成。你可以找到你的罐子在那里。

Hello all how can I create jar file of my project that is created in android using eclipse. I have done in this way project -> right-click->export --> select builder -->antbuilder-->ok then after this process build.xml will be created. On bulid.xml I will create new builder.

  • Right click on project -> properties --> select new -->give build.xml and your project path and press ok, new builder will be created.
  • Now select that builder from project properties and press ok.
  • Now build your project and your jar will be created in bin folder.

I have followed above process but my jar is not found in bin folder. I can see my build.xml is created and all process goes smooth but still jar is not created. Can any one tell me how can I do this?

My build.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
              Any modifications will be overwritten.
              To include a user specific buildfile here, simply create one in the same
              directory with the processing instruction <?eclipse.ant.import?>
              as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="testtttttttttt">
    <property environment="env"/>
    <property name="debuglevel" value="source,lines,vars"/>
    <property name="target" value="1.6"/>
    <property name="source" value="1.6"/>
    <path id="Android 2.2.libraryclasspath">
        <pathelement location="C:/Program Files (x86)/Android/android-sdk/platforms/android-8/android.jar"/>
    </path>
    <path id="com.android.ide.eclipse.adt.LIBRARIES.libraryclasspath"/>
    <path id="testtttttttttt.classpath">
        <pathelement location="bin/classes"/>
        <path refid="Android 2.2.libraryclasspath"/>
        <path refid="com.android.ide.eclipse.adt.LIBRARIES.libraryclasspath"/>
    </path>
    <target name="init">
        <mkdir dir="bin/classes"/>
        <copy includeemptydirs="false" todir="bin/classes">
            <fileset dir="src">
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy includeemptydirs="false" todir="bin/classes">
            <fileset dir="gen">
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
    </target>
    <target name="clean">
        <delete dir="bin/classes"/>
    </target>
    <target depends="clean" name="cleanall"/>
    <target depends="build-subprojects,build-project" name="build"/>
    <target name="build-subprojects"/>
    <target depends="init" name="build-project">
        <echo message="${ant.project.name}: ${ant.file}"/>
        <javac debug="true" debuglevel="${debuglevel}" destdir="bin/classes" source="${source}" target="${target}">
            <src path="src"/>
            <classpath refid="testtttttttttt.classpath"/>
        </javac>
        <javac debug="true" debuglevel="${debuglevel}" destdir="bin/classes" source="${source}" target="${target}">
            <src path="gen"/>
            <classpath refid="testtttttttttt.classpath"/>
        </javac>
    </target>
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
    <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
        <copy todir="${ant.library.dir}">
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </copy>
        <unzip dest="${ant.library.dir}">
            <patternset includes="jdtCompilerAdapter.jar"/>
            <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
        </unzip>
    </target>
    <target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
        <antcall target="build"/>
    </target>
</project>

解决方案

In Eclipse, select project, right click on the project, Select Export, From that select Jar. Then follow the simple wizard and give the destination where you want to save your jar, and finish. You can find your jar there.

这篇关于在Eclipse中的Andr​​oid项目创建的jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆