Android开发中如果将ADT 升级到17以上(包括17),如果你的项目中引用了其它第三方的jar包,在运行是就会报下面的错误。这是因为在ADT17以后第三方包统一要放在一个libs的文件夹中,如果你的第三方包(jar)没有放在这里,编译时不会将其拷贝到.dex文件中,因此在运行是会报如下错误
解决办法:在你的工程项目下创建一个libs的文件夹,将jar放到libs文件夹里即可。这个问题困扰了好久,开发中一直用的是ADT16,今天终于找到解决办法了。
08-09 09:58:06.259: W/dalvikvm(1277): Unable to resolve superclass of Lcom/demo/helloworld/widget/viewpagerindicator/simple/BaseSampleActivity; (107)
08-09 09:58:06.259: W/dalvikvm(1277): Link of class 'Lcom/demo/helloworld/widget/viewpagerindicator/simple/BaseSampleActivity;' failed
08-09 09:58:06.259: W/dalvikvm(1277): Unable to resolve superclass of Lcom/demo/helloworld/widget/viewpagerindicator/simple/SampleCirclesDefault; (451)
08-09 09:58:06.259: W/dalvikvm(1277): Link of class 'Lcom/demo/helloworld/widget/viewpagerindicator/simple/SampleCirclesDefault;' failed
08-09 09:58:06.259: D/AndroidRuntime(1277): Shutting down VM
08-09 09:58:06.259: W/dalvikvm(1277): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
08-09 09:58:06.316: E/AndroidRuntime(1277): FATAL EXCEPTION: main
08-09 09:58:06.316: E/AndroidRuntime(1277): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.demo.helloworld/com.demo.helloworld.widget.viewpagerindicator.simple.SampleCirclesDefault}: java.lang.ClassNotFoundException: com.demo.helloworld.widget.viewpagerindicator.simple.SampleCirclesDefault
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.app.ActivityThread.access$600(ActivityThread.java:123)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.os.Handler.dispatchMessage(Handler.java:99)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.os.Looper.loop(Looper.java:137)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.app.ActivityThread.main(ActivityThread.java:4424)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at java.lang.reflect.Method.invokeNative(Native Method)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at java.lang.reflect.Method.invoke(Method.java:511)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at dalvik.system.NativeStart.main(Native Method)
08-09 09:58:06.316: E/AndroidRuntime(1277): Caused by: java.lang.ClassNotFoundException: com.demo.helloworld.widget.viewpagerindicator.simple.SampleCirclesDefault
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
08-09 09:58:06.316: E/AndroidRuntime(1277): 	... 11 more