Sign up ×

Hey i get this error using the SDK though the app ID is correct.

Now when i try to authorize the app, it works fine and authorizes it, but when i try and make requests, facebook returns this error. My app is initlized properly and is not in sandbox mode.

I found No info about this problem, does someone know what can cause this?

I'm trying to upload photo using The following code :

    byte[] data = null; 

Bitmap bi = BitmapFactory.decodeFile(photoToPost); 
ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
bi.compress(Bitmap.CompressFormat.JPEG, 100, baos); 
data = baos.toByteArray(); 

Bundle params = new Bundle(); 
params.putString("method", "photos.upload"); 
params.putByteArray("picture", data); 

AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook); 

SampleUploadListener :

    public class SampleUploadListener extends BaseRequestListener { 

    public void onComplete(final String response, final Object state) { 
        try { 
            // process the response here: (executed in background thread) 
            Log.d("Facebook-Example", "Response: " + response.toString()); 
            JSONObject json = Util.parseJson(response); 
            final String src = json.getString("src"); 

            // then post the processed result back to the UI thread 
            // if we do not do this, an runtime exception will be generated 
            // e.g. "CalledFromWrongThreadException: Only the original 
            // thread that created a view hierarchy can touch its views." 

        } catch (JSONException e) { 
        } catch (FacebookError e) { 
            Log.w("Facebook-Example", "Facebook Error: " + e.getMessage()); 

    public void onFacebookError(FacebookError e, Object state) { 
        // TODO Auto-generated method stub 

share|improve this question
What error message are you getting in e.getMessage()? –  Igy Jun 11 '12 at 12:20
I'll edit it in a couple of hours, but basically just that error... and it shows the URL of the page it tries to reach –  eric.itzhak Jun 11 '12 at 12:22
So what's the exact string you're getting back from the API? There shouldn't be both 'invalid App ID' and a URL as far as I know, i can't think of an error message which would include both –  Igy Jun 11 '12 at 12:27
It's not in the same error. i just enabled debugging in the file so that's what the logcat shows –  eric.itzhak Jun 11 '12 at 12:35

1 Answer 1

up vote 3 down vote accepted

I Solved the problem.

THe problem was i created 2 instances of the Facebook object, one as global and one inside the method preforming the code mentioned above, So what happened is i never authorized the Object i tried doing the request is.

For some reason the error dosen't say that but in case this happens to you, make sure you have initialised the right Object and it has a valid session

share|improve this answer

Your Answer


