AppCompatActivity不能被解析为一个类型 [英] AppCompatActivity cannot be resolved to a type
问题描述
我想主题添加到我的项目。它需要应用程序兼容性V7。
我按在Android开发者网站上提到的步骤增加了支持库。搜索了很多后,我才知道,支持库V4将与支持库V7冲突。
所以我删除从我的项目的Android库V4。正因为如此,现在我得到了 NotificationCompa
T错误(进口android.support.v4.app.NotificationCompat;进口android.support.v4.app。 NotificationCompat.Builder;
)
我有什么关系?请人帮我解决这个问题。在此先感谢
我才知道,支持库V4将与支持库V7冲突
块引用>这是错误的。
应用程序兼容性V7与支持-V4的依赖。结果
您可以检查POM文件。<&的groupId GT; com.android.support< /的groupId>
<&的artifactId GT;应用程序兼容性-V7< / artifactId的>
<&版GT; 23.0.1< /版本>
<包装和GT;&AAR LT; /包装>
<依赖和GT;
<&依赖性GT;
<&的groupId GT; com.android.support< /的groupId>
<&的artifactId GT;支持-V4< / artifactId的>
<&版GT; 23.0.1< /版本>
<&型GT;&AAR LT; /类型>
<&范围GT;&编译LT; /&范围GT;
< /依赖性>
< /依赖和GT;您可以没有问题的应用程序兼容性和支持-V4使用。
I am trying to add Theme to my project. It requires appcompat v7.
I added the support library according to the steps mentioned in the Android developer website. After searching a lot I came to know that support library v4 will conflict with support library v7.
So I removed the android library v4 from my project. Because of that now I got the
NotificationCompa
t error(import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat.Builder;
).What I have to do? Please someone help me in resolving the issue. Thanks in advance
解决方案I came to know that support library v4 will conflict with support library v7
It is wrong.
AppCompat v7 has a dependency with support-v4.
You can check the pom file.<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>
You can use without problems the appcompat and the support-v4.
这篇关于AppCompatActivity不能被解析为一个类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!