Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
364 views
in Technique[技术] by (71.8m points)

java - How connect Mongo DB with Android application

I've generated Android project in Eclipse and everything work. I've added a few buttons etc with events. Now, I'm trying to create Mongo object but it throws an error. Have you got any solution ? Is it possible to connect both of this?

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Android is not supported in this driver. There is an open issue in the jira.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...