Java.net.UnknownHostException: graph.facebook.com

I get an UnknownHostException when trying to post a photo on a user's wall. Here is my code:

    byte[] data = null;

    Bitmap bi = BitmapFactory.decodeResource(getResources(), aDrawableId);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    bi.compress(Bitmap.CompressFormat.JPEG, 70, baos);
    data = baos.toByteArray();

    Bundle parameters = new Bundle();
    parameters.putByteArray("picture", data);
    Log.i(getClass().toString(), parameters.toString());

    AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(this.facebook);
    String method = String.format("me/photos?access_token=%s", this.facebook.getAccessToken());
    mAsyncRunner.request(method, parameters, "POST", new FacebookRequestListener(), null);

Rights to my AndroidManifest file:

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

I had the same problem as the previous question and I correct the second answer (top voted):

Post to facebook wall from android fb sdk always error

The only message I get in logcat is:

10-26 15:29:16.425: E/Facebook(5342): java.net.UnknownHostException: graph.facebook.com

Do you have any ideas on how to solve this? I am running the application in the Galaxy S2 warehouse.

+5
source share
1 answer

I'm not sure if this will fix the error you received, but a few things I noticed:

( "" ) , ( , ).

facebook sdk api, ( , POST, GET, sdk "?" , .

?

+1

All Articles