Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Friday, January 1, 2016

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. titanium

java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. titanium


I'm creating a custom theme for my Titanium application using this theme generator. But when I run my application it's crashing and my log says that I need appCompact even if I set the theme for sdk > sdk 11.

And my targeting Android version is API 19 and min SDK version is API14, so I wonder why I need appCompact.

This is what my log says:

 [ERROR] :  TiApplication: (main) [512,512] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{a.s/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.; Titanium 3.4.0,2014/09/25 16:42,b54c467  [ERROR] :  TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{a.s/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.  [ERROR] :  TiApplication:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)  [ERROR] :  TiApplication:   at android.app.ActivityThread.handleLaunchActivity(Activ  [ERROR] :  TiApplication:   at android.app.ActivityThread.access$800(ActivityThread.java:135)  [ERROR] :  TiApplication:   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)  [ERROR] :  TiApplication:   at android.os.Handler.dispatchMessage(Handler.java:102)  [ERROR] :  TiApplication:   at android.os.Looper.loop(Looper.java:136)  [ERROR] :  TiApplication:   at android.app.ActivityThread.main(ActivityThread.java:5017)  [ERROR] :  TiApplication:   at java.lang.reflect.Method.invokeNative(Native Method)  [ERROR] :  TiApplication:   at java.lang.reflect.Method.invoke(Method.java:515)  [ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)  [ERROR] :  TiApplication:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)  [ERROR] :  TiApplication:   at dalvik.system.NativeStart.main(Native Method)  [ERROR] :  TiApplication: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.  [ERROR] :  TiApplication:   at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:108)  [ERROR] :  TiApplication:   at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)  [ERROR] :  TiApplication:   at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)  [ERROR] :  TiApplication:   at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:516)  [ERROR] :  TiApplication:   at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)  [ERROR] :  TiApplication:   at android.app.Activity.performCreate(Activity.java:5231)  [ERROR] :  TiApplication:   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  [ERROR] :  TiApplication:   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)  [ERROR] :  TiApplication:   ... 11 more  

Answer by sam for java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. titanium


ok please try this,

Add this attribute to your activity

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

Answer by Nathan Walters for java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. titanium


You are using an ActionBarActivity, which requires an AppCompat theme. I'm not sure how you'd do this with Titanium, but you'd either need to switch to an AppCompat theme or use a regular Activity (which shouldn't be a problem if you're targeting 11 or above).

Answer by velraj for java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. titanium


write the code in style-v11 folder

 name="AppBaseTheme" parent="Theme.AppCompat.Light"  

and in styles-v14 folder

 name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar"  

Answer by Jasmine John for java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. titanium


Delete all the styles in the library project. Specify Style folder only in main project not in library project. It worked for me :)

Answer by Vipin Yadav for java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. titanium


Simply change the ActionBarActivity to Activity or FragmentActivity


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.