码:
package com.example.myfirstapp;import androID.support.v7.app.ActionBaractivity;import androID.support.v7.app.Actionbar;import androID.support.v4.app.Fragment;import androID.os.Bundle;import androID.vIEw.LayoutInflater;import androID.vIEw.Menu;import androID.vIEw.MenuItem;import androID.vIEw.VIEw;import androID.vIEw.VIEwGroup;import androID.os.Build;public class MainActivity extends ActionBaractivity { @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(); } } @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; } }}
logcat的:
03-18 12:27:42.529: W/dalvikvm(6930): VFY: unable to resolve static fIEld 1559 (ActionbarWindow) in LandroID/support/v7/appcompat/R$styleable;03-18 12:27:42.529: D/dalvikvm(6930): VFY: replacing opcode 0x62 at 0x000403-18 12:27:42.534: D/AndroIDRuntime(6930): Shutting down VM03-18 12:27:42.534: W/dalvikvm(6930): threadID=1: thread exiting with uncaught exception (group=0x4185d2a0)03-18 12:27:42.539: E/AndroIDRuntime(6930): FATAL EXCEPTION: main03-18 12:27:42.539: E/AndroIDRuntime(6930): java.lang.NoClassDefFoundError: androID.support.v7.appcompat.R$styleable03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.support.v7.app.ActionBaractivityDelegate.onCreate(ActionBaractivityDelegate.java:107)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.support.v7.app.ActionBaractivityDelegateICS.onCreate(ActionBaractivityDelegateICS.java:58)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.support.v7.app.ActionBaractivity.onCreate(ActionBaractivity.java:98)03-18 12:27:42.539: E/AndroIDRuntime(6930): at com.example.myfirstapp.MainActivity.onCreate(MainActivity.java:18)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.app.Activity.performCreate(Activity.java:5188)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2074)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.app.ActivityThread.access0(ActivityThread.java:140)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.os.Handler.dispatchMessage(Handler.java:99)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.os.Looper.loop(Looper.java:137)03-18 12:27:42.539: E/AndroIDRuntime(6930): at androID.app.ActivityThread.main(ActivityThread.java:4921)03-18 12:27:42.539: E/AndroIDRuntime(6930): at java.lang.reflect.Method.invokeNative(Native Method)03-18 12:27:42.539: E/AndroIDRuntime(6930): at java.lang.reflect.Method.invoke(Method.java:511)03-18 12:27:42.539: E/AndroIDRuntime(6930): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)03-18 12:27:42.539: E/AndroIDRuntime(6930): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:805)03-18 12:27:42.539: E/AndroIDRuntime(6930): at dalvik.system.NativeStart.main(Native Method)解决方法 将apptheme更改为manifest.xml中的Theme.AppCompat
<application... androID:theme="@style/theme.AppCompat" >总结
以上是内存溢出为你收集整理的android – 我的第一个应用程序已停止工作错误全部内容,希望文章能够帮你解决android – 我的第一个应用程序已停止工作错误所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)