最近想做一个Android虚拟现实的demo, 发现一个叫做AndAR的东西
https://code.google.com/p/andar/
下载了AndARSampleProject.zip解压缩然后import到Eclipse里,编译运行
程序在虚拟机上一打开就意外终止,提示,*****has stoppped,
在logcat里查看发现以下的错误
08-28 02:02:38.493: E/AndroidRuntime(346): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{edu.dhbw.andar.sample/edu.dhbw.andar.sample.CustomActivity}: java.lang.ClassNotFoundException: edu.dhbw.andar.sample.CustomActivity in loader dalvik.system.PathClassLoader@44dabac8
08-28 02:02:38.493: E/AndroidRuntime(346): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
08-28 02:02:38.493: E/AndroidRuntime(346): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
08-28 02:02:38.493: E/AndroidRuntime(346): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
08-28 02:02:38.493: E/AndroidRuntime(346): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
08-28 02:02:38.493: E/AndroidRuntime(346): at android.os.Handler.dispatchMessage(Handler.java:99)
08-28 02:02:38.493: E/AndroidRuntime(346): at android.os.Looper.loop(Looper.java:123)
08-28 02:02:38.493: E/AndroidRuntime(346): at android.app.ActivityThread.main(ActivityThread.java:4363)
08-28 02:02:38.493: E/AndroidRuntime(346): at java.lang.reflect.Method.invokeNative(Native Method)
08-28 02:02:38.493: E/AndroidRuntime(346): at java.lang.reflect.Method.invoke(Method.java:521)
08-28 02:02:38.493: E/AndroidRuntime(346): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
08-28 02:02:38.493: E/AndroidRuntime(346): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
08-28 02:02:38.493: E/AndroidRuntime(346): at dalvik.system.NativeStart.main(Native Method)
08-28 02:02:38.493: E/AndroidRuntime(346): Caused by: java.lang.ClassNotFoundException: edu.dhbw.andar.sample.CustomActivity in loader dalvik.system.PathClassLoader@44dabac8
在网上搜索,最终得到的解答方法,要把工程文件夹里的lib和libs两个目录合并,并统一命名为libs,问题解决
也就是把lib目录下的AndAR.jar文件,复制到libs下,并把lib删除,这里会出现找不到AndAR.jar的问题,因为
手动修改了路径,要在工程上点击右键->属性->在libraries标签下,修改AndAR.jar的路径为正确路径。
问题解决,但是这个实例运行起来不是很流畅,将就着用吧
参考