【问题标题】:AppCompatActivity cannot be resolved to a typeAppCompatActivity 无法解析为类型
【发布时间】:2015-10-02 18:37:24
【问题描述】:
我正在尝试将主题添加到我的项目中。它需要 appcompat v7。
我按照Android开发者网站中提到的步骤添加了支持库。经过大量搜索,我知道支持库 v4 会与支持库 v7 冲突。
所以我从我的项目中删除了 android 库 v4。因此,现在我得到了NotificationCompat 错误(import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat.Builder;)。
我必须做什么?请有人帮我解决这个问题。提前致谢
【问题讨论】:
标签:
android
android-support-library
android-appcompat
appcompatactivity
【解决方案1】:
我知道支持库 v4 会与支持库 v7 冲突
错了。
AppCompat v7 依赖于 support-v4。
您可以查看 pom 文件。
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<version>23.0.1</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>23.0.1</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
</dependencies>
您可以毫无问题地使用 appcompat 和 support-v4。