2

I am getting the following error while running and the activity does not start. The error is showing at setContentView(R.layout.activity_main); Please help.

I am using the following libraries:

compile project(':library')
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.parse:parsetwitterutils-android:1.10.5'
compile files('libs/bolts-android-1.2.0-javadoc.jar')
compile files('libs/bolts-android-1.2.0.jar')
compile files('libs/listviewanimations_lib-core-slh_3.1.0.jar')
compile files('libs/listviewanimations_lib-core_3.1.0.jar')
compile files('libs/listviewanimations_lib-manipulation_3.1.0.jar')
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/Parse-1.9.1.jar')
compile files('libs/parse-android-1.13.3.jar')
compile files('libs/ParseCrashReporting-1.9.1.jar')
compile files('libs/picasso-2.5.0.jar')
compile files('libs/universal-image-loader-1.9.3.jar')

The error is:

AndroidRuntime: FATAL EXCEPTION: main Process: com.app.android.hashmap, PID: 26336 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.android.hashmap/com.app.android.hashmap.MainActivity}: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false } at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false } at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:474) at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at com.app.android.hashmap.MainActivity.onCreate(MainActivity.java:49) at android.app.Activity.performCreate(Activity.java:6237) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

2 Answers2

1
<item name="windowActionBar">false</item>
   <item name="windowNoTitle">true</item> 

set this only in your theme found in styles.xml and delete this.

android:windowIsFloating: false
windowActionBarOverlay: false
windowActionBar: false
Kiran Benny Joseph
  • 6,755
  • 4
  • 38
  • 57
1

Android developers have made AppCompat more restricted about windowNoTitle flag as they were introduces AppCompatDialogs which are highly dependent on windowNoTitle flag - in version of 22.1.0.

So to fix your problem use your theme parent to - Theme.AppCompat.NoActionBar

If your requrement doesn't suite that, use separate theme where needed -

For example -

<style name="MyTheme" parent="Theme.AppCompat">
    ...
</style>

<style name="MyTheme.NoActionBar">
    <!-- both your properties are there -->
    <!-- Remove other ones.. i.e. windowActionBarOverlay and all -->
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

Reference - Android developer's blog

Paresh P.
  • 6,677
  • 1
  • 14
  • 26