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级别。
以前原来的程序包含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级别。
相关文章推荐
- [置顶] Android开发之viewpager导报错误解决方法:错误代码 Caused by: java.lang.ClassNotFoundException: Didn't find class
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Mac系统下执行hadoop jar 运行在某包内的程序 提示java.lang.ClassNotFoundException的解决方法
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- android studio运行程序找不到class,java.lang.ClassNotFoundException: Didn't find class,完美解决!
- java protobuf运行错误解决(java.lang.ClassNotFoundException: com.google.protobuf.MessageOrBuilder)
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- Caused by: java.lang.ClassNotFoundException[android的终极解决错误]
- 关于升级ADT22后出现java.lang.ClassNotFoundException错误的解决
- hadoop 伪分布式系统命令行运行java类报Exception in thread "main" java.lang.ClassNotFoundException:解决办法
- 【错误解决】 java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.classes.views.index_jsp