Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
如上 上面有报错信息 还有解决办法
You need to use a Theme.AppCompat theme (or descendant) with this activity.
把你的MainActivity 继承的 AppCompatActivity 改成 Activity
AppcompaActivity相对于Activity的主要的两点变化;
1:主界面带有toolbar的标题栏;
2,theme主题只能用android:theme=”@style/AppTheme (appTheme主题或者其子类),而不能用android:style。 否则会提示错误: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.