Unable to do access GAE server running on computer from Android device

5 views
Skip to first unread message

user2781902 via StackOverflow

unread,
Feb 23, 2014, 3:20:04 AM2/23/14
to google-appengin...@googlegroups.com

I'm trying out my first GAE server and Android connection. I'm running a GAE server through Android ADT on my computer(192.168.1.24). My Android device is connected in developer mode through USB. I'm trying to make a HTTP Request from the device and store the response. But I get the below error.

02-23 03:10:22.915: E/AndroidRuntime(18076): FATAL EXCEPTION: main
02-23 03:10:22.915: E/AndroidRuntime(18076): java.lang.IllegalStateException: Could not      execute method of the activity
02-23 03:10:22.915: E/AndroidRuntime(18076):    at     android.view.View$1.onClick(View.java:3838)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at android.view.View.performClick(View.java:4475)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at android.view.View$PerformClick.run(View.java:18796)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at android.os.Handler.handleCallback(Handler.java:730)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at android.os.Handler.dispatchMessage(Handler.java:92)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at android.os.Looper.loop(Looper.java:137)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at android.app.ActivityThread.main(ActivityThread.java:5455)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at java.lang.reflect.Method.invokeNative(Native Method)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at java.lang.reflect.Method.invoke(Method.java:525)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at dalvik.system.NativeStart.main(Native Method)
02-23 03:10:22.915: E/AndroidRuntime(18076): Caused by: java.lang.reflect.InvocationTargetException
02-23 03:10:22.915: E/AndroidRuntime(18076):    at java.lang.reflect.Method.invokeNative(Native Method)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at java.lang.reflect.Method.invoke(Method.java:525)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at android.view.View$1.onClick(View.java:3833)
02-23 03:10:22.915: E/AndroidRuntime(18076):    ... 11 more
02-23 03:10:22.915: E/AndroidRuntime(18076): Caused by: java.lang.IllegalArgumentException: Illegal character in scheme at index 0:     192.168.1.24:8889/myserver?username=qwerty&password=qwerty
02-23 03:10:22.915: E/AndroidRuntime(18076):    at java.net.URI.create(URI.java:727)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at httprequest.GetMethods.doGetWithResponse(GetMethods.java:28)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at com.example.tandemstory.UserAuth.doAuth(UserAuth.java:24)
02-23 03:10:22.915: E/AndroidRuntime(18076):    at com.example.tandemstory.SignIn.onSignin(SignIn.java:74)
02-23 03:10:22.915: E/AndroidRuntime(18076):    ... 14 more

The statement that initiates the http request from Android device is below.

String alias=UserAuth.doAuth(username, password);

The UserAuth.doAuth() is as below

 public static String doAuth(String username,String password) {
    // CONSTRUCT GET REQUEST URL
    String url = "192.168.1.24/myserver?username=qwerty&password=qwerty"
    // XML RESPONSE AS A STRING GETS RETURNED
    String response = GetMethods.doGetWithResponse(URL_BASE, httpClient);

    return response;
}

The GetMethods.doGetWithResponse() is as below

public static String doGetWithResponse(String mUrl,DefaultHttpClient httpClient){
    String ret=null;
    HttpResponse response=null;
    //initiate get method with username and password
    HttpGet getMethod=new HttpGet(mUrl);
    try{
        //use http client to execute method
        response=httpClient.execute(getMethod);
        if(response!=null){
            //convert http response to string
            ret=getResponseBody(response);
        }
    }catch(Exception e){
        e.printStackTrace();
    }
    return ret;
}

Please give any pointers towards the solution.



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/21965844/unable-to-do-access-gae-server-running-on-computer-from-android-device

Romin via StackOverflow

unread,
Feb 23, 2014, 11:10:16 AM2/23/14
to google-appengin...@googlegroups.com

The exception java.lang.IllegalArgumentException: Illegal character in scheme at index 0: 192.168.1.24:8889/myserver?username=qwerty&password=qwerty seems to indicate that a problem could be addressed by trying out the following:

  • prefix your URL string with http:// and see if that works.
  • prefix your URL string with http:// and also encode the URL correctly.


Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/21965844/unable-to-do-access-gae-server-running-on-computer-from-android-device/21970704#21970704
Reply all
Reply to author
Forward
0 new messages