尝试从mySQL数据库验证用户名和密码时,我的应用程序崩溃了(登录)。这是在AsyncTask方法上验证的。它在普通的Eclipse模拟器上工作正常。是否有任何设置或调整要做?是否会崩溃AsyncTask,还是有其他因素?
这是logcat:
03-14 17:01:57.755: W/EGL_genymotion(2395): eglSurfaceAttrib not implemented
03-14 17:03:00.862: W/System.err(2395): org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.2.2 refused
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
03-14 17:03:00.862: W/System.err(2395): at com.example.shareity.library.JSONParser.getJSONFromUrl(JSONParser.java:33)
03-14 17:03:00.862: W/System.err(2395): at com.example.shareity.library.UserFunctions.loginUser(UserFunctions.java:35)
03-14 17:03:00.862: W/System.err(2395): at com.example.shareity.Login$ProcessLogin.doInBackground(Login.java:204)
03-14 17:03:00.862: W/System.err(2395): at com.example.shareity.Login$ProcessLogin.doInBackground(Login.java:1)
03-14 17:03:00.862: W/System.err(2395): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-14 17:03:00.862: W/System.err(2395): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
03-14 17:03:00.862: W/System.err(2395): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
03-14 17:03:00.862: W/System.err(2395): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-14 17:03:00.862: W/System.err(2395): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
03-14 17:03:00.862: W/System.err(2395): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
03-14 17:03:00.862: W/System.err(2395): at java.lang.Thread.run(Thread.java:856)
03-14 17:03:00.862: W/System.err(2395): Caused by: java.net.ConnectException: failed to connect to /10.0.2.2 (port 80): connect failed: ETIMEDOUT (Connection timed out)
03-14 17:03:00.862: W/System.err(2395): at libcore.io.IoBridge.connect(IoBridge.java:114)
03-14 17:03:00.862: W/System.err(2395): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
03-14 17:03:00.862: W/System.err(2395): at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
03-14 17:03:00.862: W/System.err(2395): at java.net.Socket.connect(Socket.java:842)
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
03-14 17:03:00.862: W/System.err(2395): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)
03-14 17:03:00.862: W/System.err(2395): ... 17 more
03-14 17:03:00.862: W/System.err(2395): Caused by: libcore.io.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
03-14 17:03:00.862: W/System.err(2395): at libcore.io.Posix.connect(Native Method)
03-14 17:03:00.862: W/System.err(2395): at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
03-14 17:03:00.862: W/System.err(2395): at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
03-14 17:03:00.862: W/System.err(2395): at libcore.io.IoBridge.connect(IoBridge.java:112)
03-14 17:03:00.862: W/System.err(2395): ... 22 more
03-14 17:03:00.862: E/Buffer Error(2395): Error converting result java.lang.NullPointerException
03-14 17:03:00.862: E/JSON Parser(2395): Error parsing data org.json.JSONException: End of input at character 0 of
03-14 17:03:00.878: D/AndroidRuntime(2395): Shutting down VM
03-14 17:03:00.878: W/dalvikvm(2395): threadid=1: thread exiting with uncaught exception (group=0xa62d0288)
03-14 17:03:00.878: E/AndroidRuntime(2395): FATAL EXCEPTION: main
03-14 17:03:00.878: E/AndroidRuntime(2395): java.lang.NullPointerException
03-14 17:03:00.878: E/AndroidRuntime(2395): at com.example.shareity.Login$ProcessLogin.onPostExecute(Login.java:210)
03-14 17:03:00.878: E/AndroidRuntime(2395): at com.example.shareity.Login$ProcessLogin.onPostExecute(Login.java:1)
03-14 17:03:00.878: E/AndroidRuntime(2395): at android.os.AsyncTask.finish(AsyncTask.java:631)
03-14 17:03:00.878: E/AndroidRuntime(2395): at android.os.AsyncTask.access$600(AsyncTask.java:177)
03-14 17:03:00.878: E/AndroidRuntime(2395): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
03-14 17:03:00.878: E/AndroidRuntime(2395): at android.os.Handler.dispatchMessage(Handler.java:99)
03-14 17:03:00.878: E/AndroidRuntime(2395): at android.os.Looper.loop(Looper.java:137)
03-14 17:03:00.878: E/AndroidRuntime(2395): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-14 17:03:00.878: E/AndroidRuntime(2395): at java.lang.reflect.Method.invokeNative(Native Method)
03-14 17:03:00.878: E/AndroidRuntime(2395): at java.lang.reflect.Method.invoke(Method.java:511)
03-14 17:03:00.878: E/AndroidRuntime(2395): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-14 17:03:00.878: E/AndroidRuntime(2395): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-14 17:03:00.878: E/AndroidRuntime(2395): at dalvik.system.NativeStart.main(Native Method)
03-14 17:08:00.935: I/Process(2395): Sending signal. PID: 2395 SIG: 9