1

I encountered the same problem as here, but I checked my code and xml files, I use only AppCompat. I am trying to run on api 16. Here where I use it:

enter image description here

<application
    android:allowBackup="true"
    android:icon="@mipmap/main_icon"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:name=".GoogleImageSearcher"
    android:theme="@style/AppTheme" >

styles.xml

  <!-- Base application theme. -->
<style name="Base.AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/primary</item>
    <item name="colorPrimaryDark">@color/primary_dark</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowActionBarOverlay">true</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowBackground">@color/background_material_light</item>

</style>

styles-v21.xml

<style name="AppTheme" parent="Base.AppTheme">
    <!-- Customize your theme here. -->
    <item name="android:colorPrimary">@color/primary</item>
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
    <item name="android:colorAccent">@color/accent</item>
   <!-- <item name="android:navigationBarColor">@color/primary_dark</item>-->
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>

</style>

Log

   Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
        at android.support.v7.app.AppCompatDelegateImplBase.onCreate(AppCompatDelegateImplBase.java:124)
        at android.support.v7.app.AppCompatDelegateImplV7.onCreate(AppCompatDelegateImplV7.java:146)
        at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:59)
        at com.dandewine.user.tocleveroad.MainActivity.onCreate(MainActivity.java:39)

Where I missed, any advice?

Community
  • 1
  • 1
Dennis Zinkovski
  • 1,821
  • 3
  • 25
  • 42

3 Answers3

1

Try this , replace

android:theme="@style/AppTheme" >

by

 android:theme="@style/Base.AppTheme" >
eddykordo
  • 607
  • 5
  • 14
0

Check the Manifest file if you have added any incompatible theme to your app (if 'MainActivity' is a child of AppCompatActivity. its theme should be inherited form the Theme.AppCompat or from one of its children.

-3

Try setting the min api to 16 or use some additional libraries like android arsena

tahayk
  • 492
  • 1
  • 5
  • 20