Java.lang.IllegalStateException:You need to use a theme.appcompat Theme

Source: Internet
Author: User

Configuration:

Set the theme to

    <application        android:allowbackup= "true"        android:icon= "@mipmap/ic_launcher"         Android:theme = "@android: Style/theme.light.notitlebar"        android:label= "@string/app_name"        >

Error message:

09-20 10:31:58.185 1392-1392/? e/androidruntime:fatal exception:main Process:networkimageviewer.com.myapplication, PID:1392java.lang.RuntimeException:Unable to start activity componentinfo{networkimageviewer.com.myapplication/networkimageviewer.com.myapplication.welcomeactivity}: Java.lang.IllegalStateException:You need to use a Theme.appcompat Theme (or descendant) with Thisactivity. At Android.app.ActivityThread.performLaunchActivity (Activitythread.java:2192) at Android.app.ActivityThread.handleLaunchActivity (Activitythread.java:2241) at android.app.activitythread.access$(activitythread.java:141) at Android.app.activitythread$h.handlemessage (Activitythread.java:160°) at Android.os.Handler.dispatchMessage (Handler.java:102) at Android.os.Looper.loop (Looper.java:136) at Android.app.ActivityThread.main (Activitythread.java:5049) at java.lang.reflect.Method.invokeNative (Native Method) at Java.lang.reflect.Method.invoke (Met Hod.java:515) at Com.android.internal.os.zygoteinit$methodandargscaller.run (Zygoteinit.java:793) at Com.android.internal.os.ZygoteInit.main (Zygoteinit.java:609) at Dalvik.system.NativeStart.main (Native Method) caused By:java.lang.IllegalStateException:You need To use a Theme.appcompat Theme (or descendant) with Thisactivity. At Android.support.v7.app.AppCompatDelegateImplV7.createSubDecor (Appcompatdelegateimplv7.java:309) at Android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor (Appcompatdelegateimplv7.java:278) at Android.support.v7.app.AppCompatDelegateImplV7.setContentView (Appcompatdelegateimplv7.java:252) at Android.support.v7.app.AppCompatActivity.setContentView (Appcompatactivity.java:109) at Networkimageviewer.com.myapplication.WelcomeActivity.onCreate (Welcomeactivity.java:22) at Android.app.Activity.performCreate (Activity.java:5249) at Android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1087) at Android.app.ActivityThread.performLaunchActivity (Activitythread.java:2156) at Android.app.ActivityThread.handleLaunchActivity (Activitythread.java:2241) at android.app.activitythread.access$(activitythread.java:141) at Android.app.activitythread$h.handlemessage (Activitythread.java:160°) at Android.os.Handler.dispatchMessage (Handler.java:102) at Android.os.Looper.loop (Looper.java:136) at Android.app.ActivityThread.main (Activitythread.java:5049) at java.lang.reflect.Method.invokeNative (Native Method) at Java.lang.reflect.Method.invoke (Met Hod.java:515) at Com.android.internal.os.zygoteinit$methodandargscaller.run (Zygoteinit.java:793) at Com.android.internal.os.ZygoteInit.main (Zygoteinit.java:40{) at Dalvik.system.NativeStart.main (Native Method)

Workaround:
to simply add ActionBar Compat your activity or application should use @style/theme.appcompat Theme in ANDROIDMANIFEST.XM L like this:

    < Application         Android:allowbackup = "true"         android:icon= "@mipmap/ic_launcher"        android:theme= "@style/ Theme.AppCompat.Light.NoActionBar"        android:label=" @string/app_name "        >

Http://stackoverflow.com/questions/18063395/actionbarcompat-java-lang-illegalstateexception-you-need-to-use-a-theme-appcom

Java.lang.IllegalStateException:You need to use a theme.appcompat Theme

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.