在Android应用程序项目中的adt 20中添加外部jar [英] Adding external jar in adt 20 in android application projects
本文介绍了在Android应用程序项目中的adt 20中添加外部jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
07-06 10:32:07.244: E/dalvikvm(319): Could not find class 'org.AstroVed.Panchanga.Moment', referenced from method com.astroved.horawatch.HoraWatchActivity.onCreate
07-06 10:32:07.244: W/dalvikvm(319): VFY: unable to resolve new-instance 186 (Lorg/AstroVed/Panchanga/Moment;) in Lcom/astroved/horawatch/HoraWatchActivity;
07-06 10:32:07.254: D/dalvikvm(319): VFY: replacing opcode 0x22 at 0x000f
07-06 10:32:07.254: D/dalvikvm(319): VFY: dead code 0x0011-00f6 in Lcom/astroved/horawatch/HoraWatchActivity;.onCreate (Landroid/os/Bundle;)V
07-06 10:32:08.224: D/dalvikvm(319): GC_CONCURRENT freed 692K, 49% free 3439K/6727K, external 2022K/2137K, paused 4ms+4ms
07-06 10:32:08.953: D/AndroidRuntime(319): Shutting down VM
07-06 10:32:08.953: W/dalvikvm(319): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-06 10:32:08.963: E/AndroidRuntime(319): FATAL EXCEPTION: main
07-06 10:32:08.963: E/AndroidRuntime(319): java.lang.NoClassDefFoundError: org.AstroVed.Panchanga.Moment
07-06 10:32:08.963: E/AndroidRuntime(319): at com.astroved.horawatch.HoraWatchActivity.onCreate(HoraWatchActivity.java:71)
07-06 10:32:08.963: E/AndroidRuntime(319): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-06 10:32:08.963: E/AndroidRuntime(319): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
07-06 10:32:08.963: E/AndroidRuntime(319): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-06 10:32:08.963: E/AndroidRuntime(319): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-06 10:32:08.963: E/AndroidRuntime(319): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-06 10:32:08.963: E/AndroidRuntime(319): at android.os.Handler.dispatchMessage(Handler.java:99)
07-06 10:32:08.963: E/AndroidRuntime(319): at android.os.Looper.loop(Looper.java:123)
07-06 10:32:08.963: E/AndroidRuntime(319): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-06 10:32:08.963: E/AndroidRuntime(319): at java.lang.reflect.Method.invokeNative(Native Method)
07-06 10:32:08.963: E/AndroidRuntime(319): at java.lang.reflect.Method.invoke(Method.java:507)
07-06 10:32:08.963: E/AndroidRuntime(319): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-06 10:32:08.963: E/AndroidRuntime(319): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-06 10:32:08.963: E/AndroidRuntime(319): at dalvik.system.NativeStart.main(Native Method)
这是我在adt 20中的应用程序中出现的错误.....如果我正在使用外部jar。
This is the error Iam getting in my apps in adt 20.....if i am using external jar.
推荐答案
您只会遇到以下几个原因:
There are only a few reasons you will ever get this error:
- 该课程确实不存在。如果您正在使用官方示例中的代码并获取此代码,请确保您拥有该库的最新版本
- 您尚未将jar添加到构建路径中。要解决此问题,请右键单击Eclipse中的jar,然后执行Build Path►Addto Build Path。
- 您的jar不在/ libs文件夹中。将jar添加到构建路径时会发生这种情况,但较新版本的ADT需要将它放在/ libs中。把它放在那里并重新添加到构建路径。
- 你的JAR文件必须与Android兼容(不支持实际的Java 7编译类!)。
- The class genuinely doesn't exist. If you are using code from an official example and getting this, make sure you have the latest build of the library
- You have not added the jar to your build path. To fix this, right click on the jar in Eclipse, and do Build Path ► Add to Build Path.
- Your jar is not in the /libs folder. This happens when you have added the jar to the build path, but newer versions of ADT need it to be in /libs. Put it there and re-add it to the build path.
- Your JAR file must be build compatible for Android (actual Java 7 compiled classes are not supported!).
这篇关于在Android应用程序项目中的adt 20中添加外部jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文