2012-08-02 126 views
0

我正在使用android應用程序,因爲登錄部分在eclipse上沒有檢測到錯誤,但是連接並未使用mySQL數據庫建立。這裏的日誌文件使用PHP和mySQL進行Android登錄

08-02 16:25:58.063: I/global(236): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required. 
    08-02 16:25:58.074: W/System.err(236): org.json.JSONException: A JSONObject text must begin with '{' at character 1 of <br /> 
    08-02 16:25:58.084: W/System.err(236): <b>Parse error</b>: syntax error, unexpected '{' in <b>C:\Program Files\EasyPHP-12.0\www\Android\Connection.php</b> on line <b>36</b><br /> 
    08-02 16:25:58.093: W/System.err(236): at org.json.JSONTokener.syntaxError(JSONTokener.java:448) 
    08-02 16:25:58.093: W/System.err(236): at org.json.JSONObject.<init>(JSONObject.java:178) 
    08-02 16:25:58.103: W/System.err(236): at org.json.JSONObject.<init>(JSONObject.java:246) 
    08-02 16:25:58.113: W/System.err(236): at com.stage.sondage.Login.onClick(Login.java:128) 
    08-02 16:25:58.124: W/System.err(236): at android.view.View.performClick(View.java:2364) 
    08-02 16:25:58.124: W/System.err(236): at android.view.View.onTouchEvent(View.java:4179) 
    08-02 16:25:58.124: W/System.err(236): at android.widget.TextView.onTouchEvent(TextView.java:6540) 
    08-02 16:25:58.143: W/System.err(236): at android.view.View.dispatchTouchEvent(View.java:3709) 
    08-02 16:25:58.143: W/System.err(236): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 
    08-02 16:25:58.153: W/System.err(236): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 
    08-02 16:25:58.153: W/System.err(236): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 
    08-02 16:25:58.163: W/System.err(236): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 
    08-02 16:25:58.163: W/System.err(236): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 
    08-02 16:25:58.163: W/System.err(236): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884) 
    08-02 16:25:58.163: W/System.err(236): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659) 
    08-02 16:25:58.186: W/System.err(236): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107) 
    08-02 16:25:58.203: W/System.err(236): at android.app.Activity.dispatchTouchEvent(Activity.java:2061) 
    08-02 16:25:58.213: W/System.err(236): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643) 
    08-02 16:25:58.213: W/System.err(236): at android.view.ViewRoot.handleMessage(ViewRoot.java:1691) 
    08-02 16:25:58.223: W/System.err(236): at android.os.Handler.dispatchMessage(Handler.java:99) 
    08-02 16:25:58.250: W/System.err(236): at android.os.Looper.loop(Looper.java:123) 
    08-02 16:25:58.253: W/System.err(236): at android.app.ActivityThread.main(ActivityThread.java:4363) 
    08-02 16:25:58.253: W/System.err(236): at java.lang.reflect.Method.invokeNative(Native Method) 
    08-02 16:25:58.253: W/System.err(236): at java.lang.reflect.Method.invoke(Method.java:521) 
    08-02 16:25:58.253: W/System.err(236): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) 
    08-02 16:25:58.253: W/System.err(236): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
    08-02 16:25:58.253: W/System.err(236): at dalvik.system.NativeStart.main(Native Method) 
    08-02 16:25:58.273: I/NotificationService(60): enqueueToast pkg=com.stage.sondage [email protected] duration=0 

我希望很快聽到好的提示。感謝您閱讀我的問題。

-Asmae

+1

您能否發佈您的代碼的相關部分? – MrEngineer13 2012-08-02 16:50:46

回答

0

沒有看到有問題的代碼很難,沒有任何真正肯定地說,但這個錯誤看起來像從頁面本身到來。確保你連接到正確的URL並給出所有參數。它獲得JSON解析的事實表明它至少連接到該網站。

此錯誤

<b>Parse error</b>: syntax error, unexpected '{' in <b>C:\Program Files\EasyPHP-12.0\www\Android\Connection.php</b> on line <b>36</b><br /> 

幾乎肯定從PHP本身。

+0

謝謝你的回答,問題解決了它的格式的PHP文件。 – 2012-08-03 18:28:05