浅析 eclipse 项目中的".classpath" 和 ".project" 文件的作用

“.classpath” 文件

  • 定义项目的结构,如src、output、con、lib等。
  • 源文件的具体位置(kind=”src”)
  • 运行的系统环境(kind=”con”,exported=”true”)
  • 外部引用的jar(不在项目的libs文件夹中)的具体位置信息(kind=”lib”,exported=”true” )
  • 编译后的类文件(*.class)的输出目录(kind=”output”)

export指的是编译后导出到相应路径(这里的路径指的不是kind=”output”的路径,output配置只能决定 *.class 文件的输出位置),比如说jar会被导到bin/dexedLibs目录。
我试过,如果将export属性全部改为false,编译正常,但程序打开会直接崩溃,提示RuntimeException:ClassNotFound

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
    <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
    <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
    <classpathentry kind="con" path="org.eclipse.andmore.ANDROID_FRAMEWORK"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.andmore.LIBRARIES"/>
    <classpathentry exported="true" kind="con" path="org.eclipse.andmore.DEPENDENCIES"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="gen"/>
    <classpathentry exported="true" kind="lib" path="D:/SvnCheckout/2-Branch/2016918_lakala_MT100_Newland/mesdk/libs/EmvJNIService.jar"/>
    <classpathentry kind="output" path="bin/classes"/>
</classpath>

“.project” 文件

  • 工程名
  • 工程注释描述
  • 运行时需要的额外Eclipse插件
  • 指定编译信息,指定编译工具

如果你在开发过程中向工程里面加入了很多额外的插件,则必然会导致你的Eclipse启动速度变慢。在这种情况下,你可以到这个文件里面去掉一些插件,不过这样一来你在开启那些关联文件的时候会加载那些插件

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>MainActivity</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.andmore.ResourceManagerBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.andmore.PreCompilerBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>com.android.ide.eclipse.adt.ApkBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.andmore.ApkBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.andmore.AndroidNature</nature>
        <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值