fernandezpablo85/scribe-java — Issue #184: Android app, getting a NullPointerException in Request.doSend() for Yahoo API
Author: vincehorst
Created: 2011-10-26 04:55:02+00:00
State: open

Using the YahooExample.java, I am able to connect to Yahoo's API and get a response back. Works great!

However, I'm not able to get it to work inside of a simple "Hello World" Android app. Very simply, I copied the source code from YahooExample.class (with a minor adjustment -- a hard coded access token) and I try to call the Yahoo API in the main activity. It always fails before getting a response back from Yahoo. Stack trace is below.

I've correctly configured the app to have internet access and I can reach the Yahoo API URL successfully when doing a simple HttpGet().

I've really tried to do my due diligence before posting an issue here (I've tried everything I could think of, going on 3 days now...) but I'm at wits end and I need help.

Does this sound familiar? Do you know what's going on?

Stack trace:
-----
E/AndroidRuntime(2027): Caused by: java.lang.NullPointerException
E/AndroidRuntime(2027):	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.readln(HttpURLConnection.java:1181)
E/AndroidRuntime(2027):	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection$ChunkedInputStream.readChunkSize(HttpURLConnection.java:394)
E/AndroidRuntime(2027):	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection$ChunkedInputStream.(HttpURLConnection.java:346)
E/AndroidRuntime(2027):	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getContentStream(HttpURLConnection.java:1077)
E/AndroidRuntime(2027):	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1652)
E/AndroidRuntime(2027):	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:1547)
E/AndroidRuntime(2027):	at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getResponseCode(HttpURLConnection.java:1276)
E/AndroidRuntime(2027):	at org.scribe.model.Response.(Response.java:28)
E/AndroidRuntime(2027):	at org.scribe.model.Request.doSend(Request.java:101)
E/AndroidRuntime(2027):	at org.scribe.model.Request.send(Request.java:63)
-----