Search code examples
javaandroidjsonadb

Error in testing application on android device after connecting to android studio via wifi


I did follow this Connect to wifi tutorial and i was able to connect my phone to my desktop through wifi(router) and i am able to test almost all application wirelessly except those require JSON parsing. I am using wamp server and it is running but i am getting forbidden error.

This is the error in logcat. Can anyone tell me how shall i get rid of this error?? Also in my source code of the application, i did add the ip address of my desktop like this 192.168.0.105/test/stock.php instead of 10.10.0.2

My application works perfectly on the emulator but i am not able to run it on the device.

04-25 20:07:11.172 11847-11874/com.e.myapplication I/System.out﹕ ERROR : Forbidden 04-25 20:07:11.172 11847-11874/com.e.myapplication I/System.out﹕ error 04-25 20:07:11.172 11847-11847/com.e.myapplication E/log_tag﹕ Error parsing data org.json.JSONException: Value error of type java.lang.String cannot be converted to JSONArray


Solution

  • I managed to solve the problem changing a setting in the Apache httpd.conf.

    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
    

    I changed it to

    Order Deny,Allow
    Allow from all
    Allow from 127.0.0.1
    

    And now my mobile can access the web service.