curves4d / google-voice-java

Automatically exported from code.google.com/p/google-voice-java
0 stars 0 forks source link

IOException returns www.google.com when creating voice object. #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a new android project in eclipse.
2. import the google-voice-java .jar file.
3. use the following code:
public void btnTest_OnClick(View view) {
        String sUsername = "test@gmail.com";
        String sPassword = "mypass";
        String ret = "tesstjson";
        Voice voice = null;
        try {
            ret = "oldval";
            voice = new Voice(sUsername, sPassword);
            //ret = voice.getInbox();
        } catch(CaptchaRequiredException captEx) {
            System.out.println("A captcha is required.");
            System.out.println("Image URL  = "+captEx.getCaptchaUrl());
            System.out.println("Capt Token = "+captEx.getCaptchaToken());
            System.out.println("Goodbye.");
        } catch (IOException e) {
            System.out.println("IO error creating voice! - "+e.getLocalizedMessage());
            System.out.println("Goodbye.");
        }
        new AlertDialog.Builder(this)
        .setTitle("Google Voice Inbox")
        .setMessage(ret)
        .show();
    }

What is the expected output? What do you see instead?
I expect it to run through and create a voice object.
Instead it trips the IOException and I get:
IO error creating voice! - www.google.com

that doesn't even seem like an error to me, I just don't know what it means.

What version of the product are you using? On what operating system?
version 1.14
running on android 2.3.3

Please provide any additional information below.
After doing quite a bit of troubleshooting on my own, I copied the code from 
the test file under source.  It is still giving me the same error.

Original issue reported on code.google.com by jereme.g...@gmail.com on 18 Oct 2012 at 1:11

GoogleCodeExporter commented 8 years ago
Update: I found new information in the Log.
The code goes through the init function into the login function.
it throws the error: java.net.UnknownHostException: www.google.com

I am using the virtual android device to test on.  Even though the virtual 
device is able to access the internet just fine, perhaps it is causing problems 
for the app resolving the domain name.

Original comment by jereme.g...@gmail.com on 18 Oct 2012 at 1:37

GoogleCodeExporter commented 8 years ago
Update: real phone did not resolve the issue.
I stepped through the code in debug mode, but did not find any new information. 
 The UnknownHostException for (www.google.com) is tripped deep inside the 
HttpsURLConnectionImpl$HttpsEngine.  I tried looking at the URL as it was being 
built and passed into the functions, but I could not find anything wrong with 
it.
So far I am still stumped.

Original comment by jereme.g...@gmail.com on 20 Oct 2012 at 3:00

GoogleCodeExporter commented 8 years ago
Resolution: I feel like an idiot now.  Turns out I forgot to request Internet 
privileges.  The following link guided me to the solution: 
http://stackoverflow.com/questions/3557996/android-httprequest-java-net-unknownh
ostexception

I added this line:
    <uses-permission
        android:name="android.permission.INTERNET" />

To the AndroidManifest.xml file and all was good in the world again.

Original comment by jereme.g...@gmail.com on 20 Oct 2012 at 11:00

GoogleCodeExporter commented 8 years ago
Closing bug. Thank you!

Original comment by teisentr...@gmail.com on 11 Dec 2012 at 11:31