-1

i m new to android and just started to write the first hello world code on android studio 1.2.2 and run on the emulator (gennymotion) and i m getting IllegalStateException and in emulator it is showing

unfortunately ur app has stopped.

 java.lang.RuntimeException: Unable to start activity ComponentInfo{jewellers.am.com.amjewellers/jewellers.am.com.amjewellers.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
3
  • Please post the logs from logcat
    – Psypher
    Jun 30, 2015 at 19:33
  • and maybe also some code
    – Maximosaic
    Jun 30, 2015 at 19:51
  • 1
    Please accurately transcribe error messages - I'm pretty sure Android doesn't say "ur app" or if it does, you have a highly suspect installation. As for the problem itself, what about the error message is mysterious? It seems to be rather self explanatory. Jul 1, 2015 at 3:07

1 Answer 1

0

This error caused because you had not use AppCompat theme:

Your application theme must be:

android:theme="@style/Theme.AppCompat.Light"

Manifest file looks like this:

<application
   android:allowBackup="true"
   android:icon="@drawable/ic_launcher"
   android:label="@string/app_name"
   android:theme="@style/Theme.AppCompat.Light" >

Make sure you have added AppCompat v7 library in project and you have to extends ActionBarActivity.

Hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.