0

I am getting the following Logcat information when I click a button on my app:

06-19 11:24:45.308: E/AndroidRuntime(11498): FATAL EXCEPTION: main
06-19 11:24:45.308: E/AndroidRuntime(11498): java.lang.IllegalStateException: Could not execute method of the activity
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.view.View$1.onClick(View.java:3674)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.view.View.performClick(View.java:4198)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.view.View$PerformClick.run(View.java:17164)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.os.Handler.handleCallback(Handler.java:615)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.os.Handler.dispatchMessage(Handler.java:92)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.os.Looper.loop(Looper.java:137)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.app.ActivityThread.main(ActivityThread.java:4918)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at java.lang.reflect.Method.invokeNative(Native Method)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at java.lang.reflect.Method.invoke(Method.java:511)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at dalvik.system.NativeStart.main(Native Method)
06-19 11:24:45.308: E/AndroidRuntime(11498): Caused by: java.lang.reflect.InvocationTargetException
06-19 11:24:45.308: E/AndroidRuntime(11498):    at java.lang.reflect.Method.invokeNative(Native Method)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at java.lang.reflect.Method.invoke(Method.java:511)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at android.view.View$1.onClick(View.java:3669)
06-19 11:24:45.308: E/AndroidRuntime(11498):    ... 11 more
06-19 11:24:45.308: E/AndroidRuntime(11498): Caused by: java.lang.NoClassDefFoundError: com.facebook.android.MainActivity$UpdateStatusListener
06-19 11:24:45.308: E/AndroidRuntime(11498):    at com.facebook.android.MainActivity.triggerDialog(MainActivity.java:55)
06-19 11:24:45.308: E/AndroidRuntime(11498):    at com.facebook.android.MainActivity.firstClicked(MainActivity.java:36)
06-19 11:24:45.308: E/AndroidRuntime(11498):    ... 14 more

Here is how I have my classes set up following an example using the Facebook SDK for Android, with only the relevant methods and info displayed here:

public class MainActivity extends Activity {

    //triggered when the button is clicked
    public void firstClicked(View view)
    {
        triggerDialog();
    }

    public void triggerDialog()
    {
                //assume for the sake of this post that this string array has 4 strings
            String[] offer_details = postOffer.getDetails();
            Bundle params = new Bundle();
                params.putString("caption", getString(R.string.app_name));  //Hackbook for Android

                Utility.mFacebook.dialog(MainActivity.this, "feed", params, new UpdateStatusListener());
    }

    public class UpdateStatusListener extends BaseDialogListener {

        @Override
        public void onComplete(Bundle values) {
            Log.i("wbbug","Status post complete.");
            final String postId = values.getString("post_id");
            if (postId != null) {
                Toast toast = Toast.makeText(getApplicationContext(), "Facebook status update successful", Toast.LENGTH_LONG);
                toast.show();
            } else {
                Toast toast = Toast.makeText(getApplicationContext(), "No wall post made",
                        Toast.LENGTH_LONG);
                toast.show();
            }
        }

    }


}

This is all directly following an example from the Facebook SDK, and the example is working with this basic code. Why is it that it cannot find the class UpdateStatusListener()? Thanks!

AggieDev
  • 5,015
  • 9
  • 26
  • 48
  • If you are using Eclipse with the R22 tools, make sure that the "Order & Export" portion of your build path is properly configured: http://stackoverflow.com/questions/16596969/libraries-do-not-get-added-to-apk-anymore-after-upgrade-to-adt-22/16596990#16596990 – CommonsWare Jun 19 '13 at 18:17
  • Where is your OnCreate() Method? – selva_pollachi Jun 19 '13 at 18:24

0 Answers0