您的位置:首页 > 移动开发 > Android开发

Android最新的开发环境运行原来环境开发的程序报java.lang.ClassNotFoundException错误解决

2013-06-08 18:16 766 查看
今天下载了一个最新的android开发环境,进行使用,但是在使用过程中遇到了一个问题,很纠结,下面就这个问题给大家分享,

以前原来的程序包含viewpager时,在运行时会报出java.lang.ClassNotFoundException异常,纠结了很久才解决。

最后总结分析,总结了这样的错误,应该是.classPath文件发生了变化。

之前的.classpath文件是:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

现在使用最新版本编译过的是.classpath文件是:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>


后来我又新建了一个工程,发现.classPath文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<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="output" path="bin/classes"/>
</classpath>


此时却别就出来了:
即将这个

<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>

改成这个就可以了
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>

然后再次运行就可以了

android:minSdkVersion — 指明该应用程序可以运行的API最低版本。默认是“1”。
android:targetSdkVersion — 指明该应用程序设计时期望运行的目标API版本。在某些情况下,这允许应用程序使用目标API级别下定义的清单元素或行为,而不是只限于使用最低API级别定义的内容。

android:maxSdkVersion — 指明该应用程序可以运行的最高API级别。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  异常
相关文章推荐