在 Android 中使用 AppCompatActivity

Working with AppCompatActivity in Android

通过关注 this tutorials

来开发 Android 推送通知应用程序

这是我遇到的问题,如图所示 .

您至少需要 22.1 版的支持库。 鉴于 ActionBarActivity 对您有效,但 AppCompatActivity 不适用,您可能拥有没有 AppCompatActivity 的旧版本支持库。

来自here

The major revision for v22.1 is the deprecation of ActionBarActivity. It initially served as a convenient way to bring the ActionBar to the Android 2.1 and above, and would act as a compatibility layer for any version of Android that already included it (starting with Android 3.0 Honeycomb). Taking its place will be AppCompatActivity. On the surface, the new class will offer all of the same functionality, but it's built on top of a new AppCompatDelegate that can be used to enable most of the same features without requiring developers to inherit from AppCompatActivity. This re-engineering effort is also serving as the base for a new AlertDialog class, so every part of the user interface can benefit from the extensive list of theming features that were demonstrated for Lollipop.

转到您的 SDK 管理器,查看您安装的支持库的版本:

如果低于22.1,请下载最新版本,然后将项目中的jar文件替换为新的。