threadid = 1:线程退出,未捕获异常(group = 0x40b1f930)

时间:2014-06-26 23:16:07

标签: java android

我的应用程序崩溃,甚至没有出现在屏幕上。任何人都可以告诉我是什么导致错误以及如何解决它?我在线查看但找不到与错误代码0x40b1f930有关的任何内容。

public class MainActivity extends ActionBarActivity {
int i = 0;
int score = 0;
int lives = 5;
int xValue = 0;
int yValue = 0;
Thread gameThread;
Boolean gameover = true;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment()).commit();
    }
    gameThread = new Thread() {
        public void run() {
            try {
                sleep(1000);
                if (!gameover) {
                    while(!gameover) {
                        if (i == 0) {
                            //add image
                        }

                        if (score < 10) {
                            if (i > 40) {
                                //remove image
                                lives--;
                                i = 0;
                            }
                        }
                        else if (score >= 10 && score < 25) {
                            if (i > 30) {
                                //remove image
                                lives--;
                                i = 0;
                            }
                        }
                        else if (score >= 25 && score < 40) {
                            if (i > 20) {
                                //remove image
                                lives--;
                                i = 0;
                            }
                        }
                        else {
                            if (i > 10) {
                                //remove image
                                lives--;
                                i = 0;
                            }
                        }
                    }//end of while
                }
            } //end of try
            catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }; //end of gameThread
} //end of on create

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container,
                false);
        return rootView;
    }
}
public void gameStartMethod() {
    gameover = false;
    //remove startButton
    gameThread.start();
    score = 0;
    lives = 5;
    i = 0;
}
}

日志文件如下所示:

06-27 08:59:43.780: I/Process(30512): Sending signal. PID: 30512 SIG: 9

06-27 08:59:46.140: W/dalvikvm(30719): VFY: unable to resolve static field 1559 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable;

06-27 08:59:46.140: D/dalvikvm(30719): VFY: replacing opcode 0x62 at 0x0004

06-27 08:59:46.140: D/AndroidRuntime(30719): Shutting down VM

06-27 08:59:46.140: W/dalvikvm(30719): threadid=1: thread exiting with uncaught exception 
(group=0x40b1f930)

06-27 08:59:46.140: E/AndroidRuntime(30719): FATAL EXCEPTION: main

06-27 08:59:46.140: E/AndroidRuntime(30719): java.lang.NoClassDefFoundError: 
android.support.v7.appcompat.R$styleable

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at pineappletech.com.reactiontest.MainActivity.onCreate(MainActivity.java:23)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.app.Activity.performCreate(Activity.java:5104)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.app.ActivityThread.access$600(ActivityThread.java:141)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.os.Handler.dispatchMessage(Handler.java:99)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.os.Looper.loop(Looper.java:137)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at android.app.ActivityThread.main(ActivityThread.java:5041)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at java.lang.reflect.Method.invokeNative(Native Method)
06-27 08:59:46.140: E/AndroidRuntime(30719):    at java.lang.reflect.Method.invoke(Method.java:511)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)

06-27 08:59:46.140: E/AndroidRuntime(30719):    at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

看起来没有找到库android.support.v7.appcompat.R $ styleable ..你是否在构建设置中包含它?