我刚刚下载并开始使用Android SDK并按照他们的说明创建了#34;我的第一个应用程序"它说" Hello World。"我没有改变代码中的任何内容。我正在运行一个Nexus 7模拟器(每次运行它时都不会崩溃)。当我运行应用程序时,它在模拟器上显示"不幸的是我的第一个应用程序已停止工作。"
这是logcat:
05-16 13:05:48.742: W/dalvikvm(1066): VFY: unable to resolve static field 1559 (ActionBarWindow) in Landroid/support/v7/appcompat/R$styleable;
05-16 13:05:48.742: D/dalvikvm(1066): VFY: replacing opcode 0x62 at 0x0004
05-16 13:05:48.752: D/AndroidRuntime(1066): Shutting down VM
05-16 13:05:48.752: W/dalvikvm(1066): threadid=1: thread exiting with uncaught exception (group=0xb2ac5ba8)
05-16 13:05:48.812: E/AndroidRuntime(1066): FATAL EXCEPTION: main
05-16 13:05:48.812: E/AndroidRuntime(1066): Process: com.example.myfirstapp, PID: 1066
05-16 13:05:48.812: E/AndroidRuntime(1066): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
05-16 13:05:48.812: E/AndroidRuntime(1066): at com.example.myfirstapp.MainActivity.onCreate(MainActivity.java:18)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.app.Activity.performCreate(Activity.java:5231)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.os.Handler.dispatchMessage(Handler.java:102)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.os.Looper.loop(Looper.java:136)
05-16 13:05:48.812: E/AndroidRuntime(1066): at android.app.ActivityThread.main(ActivityThread.java:5017)
05-16 13:05:48.812: E/AndroidRuntime(1066): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 13:05:48.812: E/AndroidRuntime(1066): at java.lang.reflect.Method.invoke(Method.java:515)
05-16 13:05:48.812: E/AndroidRuntime(1066): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
05-16 13:05:48.812: E/AndroidRuntime(1066): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
05-16 13:05:48.812: E/AndroidRuntime(1066): at dalvik.system.NativeStart.main(Native Method)
05-16 13:05:51.822: I/Process(1066): Sending signal. PID: 1066 SIG: 9
有什么想法?同样,这是创建新应用时的默认代码,因此我不确定为什么它不起作用...感谢您的帮助
答案 0 :(得分:2)
这就是我解决这个问题的方法:
如果你已经在libs文件夹中有jar文件,那么首先从libs文件夹中删除jar ,然后执行上述步骤..
确保您在Manifest.xml中的活动具有正确的主题
<activity
android:name="***.*****.******"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light"
>
希望有所帮助......