"Unfortunately My First App has stopped working
本问题已经有最佳答案,请猛点这里访问。
我刚刚下载并开始使用Android SDK,并按照他们的说明创建了"我的第一个应用程序",上面写着"你好,世界",我没有更改任何代码。我正在运行一个Nexus7模拟器(只有一个不会在每次运行时崩溃)。当我运行这个应用程序时,它在模拟器上说,"不幸的是,我的第一个应用程序已经停止工作了。"
这是logcat:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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 |
有什么想法吗?同样,这是创建新应用时的默认代码,所以我不确定为什么它不能工作…谢谢你的帮助
我就是这样解决这个问题的:
如果jar文件已经在libs文件夹中,那么首先从libs文件夹中删除jar,然后执行上述步骤。
确保您的in yout manifest.xml活动具有正确的主题
1 2 3 4 5 | <activity android:name="***.*****.******" android:label="@string/app_name" android:theme="@style/Theme.AppCompat.Light" > |
希望它有帮助。