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

举报
福州司马懿 发表于 2021/11/19 03:05:56 2021/11/19
【摘要】 “.classpath” 文件 定义项目的结构,如src、output、con、lib等。 源文件的具体位置(kind=”src”)运行的系统环境(kind=”con”,exported=”true”)...

“.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>
  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

“.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>

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50

文章来源: blog.csdn.net,作者:福州-司马懿,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/chy555chy/article/details/52678522

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。