我已經在Eclipse中生成Android項目,並且一切正常。我已經添加了幾個按鈕等事件。現在,我正在嘗試創建Mongo對象,但它會引發錯誤。你有任何解決方案?可以連接這兩個嗎?如何連接MongoDB與Android應用程序
LOG:未在此驅動程序支持
07-11 12:40:17.655: E/AndroidRuntime(724): FATAL EXCEPTION: main
07-11 12:40:17.655: E/AndroidRuntime(724): java.lang.IllegalStateException: Could not execute method of the activity
07-11 12:40:17.655: E/AndroidRuntime(724): at android.view.View$1.onClick(View.java:3591)
07-11 12:40:17.655: E/AndroidRuntime(724): at android.view.View.performClick(View.java:4084)
07-11 12:40:17.655: E/AndroidRuntime(724): at android.view.View$PerformClick.run(View.java:16966)
07-11 12:40:17.655: E/AndroidRuntime(724): at android.os.Handler.handleCallback(Handler.java:615)
07-11 12:40:17.655: E/AndroidRuntime(724): at android.os.Handler.dispatchMessage(Handler.java:92)
07-11 12:40:17.655: E/AndroidRuntime(724): at android.os.Looper.loop(Looper.java:137)
07-11 12:40:17.655: E/AndroidRuntime(724): at android.app.ActivityThread.main(ActivityThread.java:4745)
07-11 12:40:17.655: E/AndroidRuntime(724): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 12:40:17.655: E/AndroidRuntime(724): at java.lang.reflect.Method.invoke(Method.java:511)
07-11 12:40:17.655: E/AndroidRuntime(724): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
07-11 12:40:17.655: E/AndroidRuntime(724): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-11 12:40:17.655: E/AndroidRuntime(724): at dalvik.system.NativeStart.main(Native Method)
07-11 12:40:17.655: E/AndroidRuntime(724): Caused by: java.lang.reflect.InvocationTargetException
07-11 12:40:17.655: E/AndroidRuntime(724): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 12:40:17.655: E/AndroidRuntime(724): at java.lang.reflect.Method.invoke(Method.java:511)
07-11 12:40:17.655: E/AndroidRuntime(724): at android.view.View$1.onClick(View.java:3586)
07-11 12:40:17.655: E/AndroidRuntime(724): ... 11 more
07-11 12:40:17.655: E/AndroidRuntime(724): Caused by: java.lang.NoClassDefFoundError: com.mongodb.DBPortPool
07-11 12:40:17.655: E/AndroidRuntime(724): at com.mongodb.DBPortPool$Holder.get(DBPortPool.java:58)
07-11 12:40:17.655: E/AndroidRuntime(724): at com.mongodb.DBTCPConnector.setMasterAddress(DBTCPConnector.java:486)
07-11 12:40:17.655: E/AndroidRuntime(724): at com.mongodb.DBTCPConnector.<init>(DBTCPConnector.java:46)
07-11 12:40:17.655: E/AndroidRuntime(724): at com.mongodb.Mongo.<init>(Mongo.java:192)
07-11 12:40:17.655: E/AndroidRuntime(724): at com.mongodb.Mongo.<init>(Mongo.java:176)
07-11 12:40:17.655: E/AndroidRuntime(724): at com.mongodb.Mongo.<init>(Mongo.java:130)
07-11 12:40:17.655: E/AndroidRuntime(724): at com.example.easyrest.MainActivity.clickAddOfferButton_offer(MainActivity.java:66)
07-11 12:40:17.655: E/AndroidRuntime(724): ... 14 more
你得到了什麼類型的錯誤?你能發佈錯誤嗎? – 2012-07-11 12:55:13
我修改了我的帖子 – ruhungry 2012-07-11 12:59:07
java.lang.NoClassDefFoundError表示VM在執行過程中無法加載類com.mongodb.DBPortPool。 – 2012-07-11 13:01:19