I have just downloaded and started using the android SDK and have followed their instructions on creating "my first app" which says "Hello World." I have not changed anything in the code. I am running a Nexus 7 emulator (only one that doesn't crash every time I run it). When I run the app, on the emulator it says "Unfortunately my first app has stopped working."
Here is the 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
Any thoughts? Again, this is the default code upon creating a new app, so I'm not sure why it wouldn't work... Thanks for the help
Answer
This is how I solved this problem:
- Import support library as a project from
"sdk/extras/android/support/v7/appcompat". - Reference library in your project (for Eclipse, "Properties -
Android - Add"). - Build projects (for Eclipse, "Projects - Build All"). Make sure, you
have "android.support.v7.appcompat" in your main project gen folder. - If it doesn't worked - clean and rebuild project.
and if you have the jar file already in libs folder then first Delete the jar from the libs folder and then do the above steps..
Ensure that your in yout Manifest.xml your activity has the correct theme
android:name="***.*****.******"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.Light"
>
Hope it helps..
No comments:
Post a Comment