java.lang.IllegalArgumentException: AppCompat does not support the current theme features

后端 未结 15 1067
你的背包
你的背包 2020-12-04 11:32

I tried to migrate a project from Eclipse to Android studio. Finally I am able to run it, but at a certain point I got this exception, and I found nothing in google about th

相关标签:
15条回答
  • 2020-12-04 12:19

    Make sure that your theme is child from Theme.AppCompat.NoActionBar, then in styles.xml:

    <style name="MyMaterialTheme" parent="Theme.AppCompat.NoActionBar">
            <item name="windowNoTitle">true</item>
            ...
    </style>
    

    Btw, it's a new issue for Support Library 22.1.

    0 讨论(0)
  • 2020-12-04 12:19

    Use this parent in Style.xml parent="Theme.AppCompat.Light.NoActionBar"

    0 讨论(0)
  • 2020-12-04 12:20

    In my case, I look for @rewrihitesh answer, and I notice that I inverted elements order. Changing from

    setContentView(R.layout.activity_test);
    super.onCreate(savedInstanceState);
    

    to

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);
    

    Fix my problem.

    Hope it helps !!

    0 讨论(0)
  • 2020-12-04 12:21

    Check if you call setContentView() after super.onCreate(), and not before. This helped in my case.

    0 讨论(0)
  • 2020-12-04 12:29

    I had the same problem when I upgraded the library version from 22.0.0 to 22.1.1 and fixed it by dropping back to the previous version: com.android.support:appcompat-v7:22.0.0 and go back to using ActionBarActivity, not AppCompatActivity in my Activity classes as required by the newer version of the compatibility library. I'll try again later.

    0 讨论(0)
  • 2020-12-04 12:33

    Make sure that

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    

    are at the top of everything this works for me....good luck

    0 讨论(0)
提交回复
热议问题