What causes android exception “You need to use a Theme.AppCompat theme (or descendant) with this activity.”

后端 未结 2 2026
夕颜
夕颜 2021-01-14 18:32

I am attempting to try out the new Material Theme in Android.

I am currently stuck with this exception

03-06 09:35:50.177: D/AndroidRuntime(30607): S         


        
2条回答
  •  有刺的猬
    2021-01-14 19:12

    You are attempting to use a feature (from the design library, for example) which was introduced after your target sdk. Therefore, you need to use a couple of libraries (design and appcompat), one of which is the AppCompat Theme (backwards app compatibility).

    In your Manifest file, include in your application declaration

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

    Rebuild and your problem should be solved.

提交回复
热议问题