我试图让这个项目在我的开发电脑上运行。但是当我尝试注册一个新用户时,这是我被 logcat 抛出的错误(附件是会话的 logcat 错误日志)
这是我正在关注的教程,
http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
11-03 11:56:24.685: D/dalvikvm(2279): GC_FOR_ALLOC freed 206K, 9% free 3763K/4096K, paused 2ms, total 6ms
11-03 11:56:24.925: E/JSON(2279): <br />
11-03 11:56:24.925: E/JSON(2279): <font size='1'><table class='xdebug-error xe-deprecated' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
11-03 11:56:24.925: E/JSON(2279): <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\ah_login_api\include\DB_Connect.php on line <i>18</i></th></tr>
11-03 11:56:24.925: E/JSON(2279): <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
11-03 11:56:24.925: E/JSON(2279): <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>
11-03 11:56:24.925: E/JSON(2279): <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0010</td><td bgcolor='#eeeeec' align='right'>252816</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:\wamp\www\ah_login_api\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>0</td></tr>
11-03 11:56:24.925: E/JSON(2279): <tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0010</td><td bgcolor='#eeeeec' align='right'>276616</td><td bgcolor='#eeeeec'>DB_Functions->__construct( )</td><td title='C:\wamp\www\ah_login_api\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>19</td></tr>
11-03 11:56:24.925: E/JSON(2279): <tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.0010</td><td bgcolor='#eeeeec' align='right'>282712</td><td bgcolor='#eeeeec'>DB_Connect->connect( )</td><td title='C:\wamp\www\ah_login_api\include\DB_Functions.php' bgcolor='#eeeeec'>..\DB_Functions.php<b>:</b>13</td></tr>
11-03 11:56:24.925: E/JSON(2279): <tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.0010</td><td bgcolor='#eeeeec' align='right'>283528</td><td bgcolor='#eeeeec'><a href='http://www.php.net/function.mysql-connect' target='_new'>mysql_connect</a>
11-03 11:56:24.925: E/JSON(2279): ( )</td><td title='C:\wamp\www\ah_login_api\include\DB_Connect.php' bgcolor='#eeeeec'>..\DB_Connect.php<b>:</b>18</td></tr>
11-03 11:56:24.925: E/JSON(2279): </table></font>
11-03 11:56:24.925: E/JSON(2279): {"tag":"register","success":1,"error":0,"uid":"5457b44f108d33.70669064","user":{"name":"fdgdf","email":"dfgfd@gmail.com","created_at":"2014-11-04 00:58:55","updated_at":null}}
11-03 11:56:24.925: E/JSON Parser(2279): Error parsing data org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
11-03 11:56:24.935: D/AndroidRuntime(2279): Shutting down VM
11-03 11:56:24.935: W/dalvikvm(2279): threadid=1: thread exiting with uncaught exception (group=0xb2d12b20)
11-03 11:56:24.935: E/AndroidRuntime(2279): FATAL EXCEPTION: main
11-03 11:56:24.935: E/AndroidRuntime(2279): Process: com.example.androidhive, PID: 2279
11-03 11:56:24.935: E/AndroidRuntime(2279): java.lang.NullPointerException
11-03 11:56:24.935: E/AndroidRuntime(2279): at com.example.androidhive.RegisterActivity$1.onClick(RegisterActivity.java:66)
11-03 11:56:24.935: E/AndroidRuntime(2279): at android.view.View.performClick(View.java:4438)
11-03 11:56:24.935: E/AndroidRuntime(2279): at android.view.View$PerformClick.run(View.java:18422)
11-03 11:56:24.935: E/AndroidRuntime(2279): at android.os.Handler.handleCallback(Handler.java:733)
11-03 11:56:24.935: E/AndroidRuntime(2279): at android.os.Handler.dispatchMessage(Handler.java:95)
11-03 11:56:24.935: E/AndroidRuntime(2279): at android.os.Looper.loop(Looper.java:136)
11-03 11:56:24.935: E/AndroidRuntime(2279): at android.app.ActivityThread.main(ActivityThread.java:5017)
11-03 11:56:24.935: E/AndroidRuntime(2279): at java.lang.reflect.Method.invokeNative(Native Method)
11-03 11:56:24.935: E/AndroidRuntime(2279): at java.lang.reflect.Method.invoke(Method.java:515)
11-03 11:56:24.935: E/AndroidRuntime(2279): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-03 11:56:24.935: E/AndroidRuntime(2279): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-03 11:56:24.935: E/AndroidRuntime(2279): at dalvik.system.NativeStart.main(Native Method)
我错过了什么?顺便说一句,我已经创建了所有必要的数据库并输入了用户和密码。只是补充一点,当我试图访问我通过本地主机从上述站点下载的 index.php 时,它表示该网页不可用,尽管我相信它只是作为 JSON 的起点而不是实际上的索引页..如果我错了,请纠正我。