单击按钮时,应用程序在Android上崩溃

时间:2013-06-19 17:30:35

标签: java android eclipse sdk

当我点击我的应用程序上的按钮时,我收到以下Logcat信息:

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

以下是我使用Facebook SDK for Android设置示例的方法,只显示了相关的方法和信息:

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();
            }
        }

    }


}

这一切都直接遵循Facebook SDK中的示例,示例正在使用此基本代码。为什么它找不到类UpdateStatusListener()?谢谢!

0 个答案:

没有答案