Bob
Bob

Reputation: 13

Json and android Error

I'm trying to build a app that will connect to a remote sever in this case local host, the program i wrote so far is trying to log a user in and depending of thier 'type' a different interface will open. I'm getting some Json parser error probably HTML error. Also some java error in my AsyncTask. My logcat is below ;

02-18 06:57:22.391: E/JSON Parser(1817): Error parsing data org.json.JSONException: Expected ':' after main at character 6 of {main}(  )</td><td title='C:\wamp\www\android_connect\selectUser.php' bgcolor='#eeeeec'>..\selectUser.php<b>:</b>0</td></tr>
02-18 06:57:22.391: E/JSON Parser(1817): </table></font>
02-18 06:57:22.391: E/JSON Parser(1817): <br />
02-18 06:57:22.391: E/JSON Parser(1817): <font size='1'><table class='xdebug-error xe-notice' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
02-18 06:57:22.391: E/JSON Parser(1817): <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Undefined index: password in C:\wamp\www\android_connect\selectUser.php on line <i>18</i></th></tr>
02-18 06:57:22.391: E/JSON Parser(1817): <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
02-18 06:57:22.391: E/JSON Parser(1817): <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
02-18 06:57:22.391: E/JSON Parser(1817): <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0029</td><td bgcolor='#eeeeec' align='right'>252392</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='C:\wamp\www\android_connect\selectUser.php' bgcolor='#eeeeec'>..\selectUser.php<b>:</b>0</td></tr>
02-18 06:57:22.391: E/JSON Parser(1817): </table></font>
02-18 06:57:22.391: E/JSON Parser(1817): {"success":0,"message":"No User found"}
02-18 06:57:22.421: W/dalvikvm(1817): threadid=11: thread exiting with uncaught exception (group=0xb1a24b90)
02-18 06:57:22.561: E/AndroidRuntime(1817): FATAL EXCEPTION: AsyncTask #1
02-18 06:57:22.561: E/AndroidRuntime(1817): Process: com.example.newjudoapp, PID: 1817
02-18 06:57:22.561: E/AndroidRuntime(1817): java.lang.RuntimeException: An error occured while executing doInBackground()
02-18 06:57:22.561: E/AndroidRuntime(1817):     at android.os.AsyncTask$3.done(AsyncTask.java:300)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at java.lang.Thread.run(Thread.java:841)
02-18 06:57:22.561: E/AndroidRuntime(1817): Caused by: java.lang.NullPointerException
02-18 06:57:22.561: E/AndroidRuntime(1817):     at com.example.newjudoapp.MainActivity$selectUser.doInBackground(MainActivity.java:260)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at com.example.newjudoapp.MainActivity$selectUser.doInBackground(MainActivity.java:1)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at android.os.AsyncTask$2.call(AsyncTask.java:288)
02-18 06:57:22.561: E/AndroidRuntime(1817):     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
02-18 06:57:22.561: E/AndroidRuntime(1817):     ... 4 more

Upvotes: 0

Views: 135

Answers (1)

Ben Barkay
Ben Barkay

Reputation: 5632

You are getting a PHP error, which is formatted as HTML. Try to fix the error in the PHP file, it's specified in the logs you pasted (password is undefined, on line 18 of selectUser.php).

Upvotes: 1

Related Questions