Failed to load AppCompat ActionBar with unknown error

前言

今天安装写一个test的demo的时候,创建项目的时候出现这个错误。
然后我想啊,谁会去用这个actionBar啊,然后我找到main下的androidManifect.xml:

<application
	android:allowBackup="true"
	android:icon="@mipmap/ic_launcher"
	android:label="@string/app_name"
	android:roundIcon="@mipmap/ic_launcher_round"
	android:supportsRtl="true"
	android:theme="@style/Theme.AppCompat.Light.NoActionBar">
	<activity android:name=".MainActivity">
		<intent-filter>
			<action android:name="android.intent.action.MAIN" />
			<category android:name="android.intent.category.LAUNCHER" />
		</intent-filter>
	</activity>
	<activity android:name=".notificationActivity">
	</activity>
</application>

改成了:@style/Theme.AppCompat.Light.NoActionBar 反正我不使用就行呗,真正的项目谁会用这个东西哦。
然后就傻眼了,跳转到下一页,没有返回键。
看来还是要有一个bar的。

解决

在androidmanifect.xml 不变,还是android:theme="@style/AppTheme"
然后再style.xml中改下。
百度的:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
改为:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
原文地址:https://www.cnblogs.com/aoximin/p/12221230.html