AppCompatActivity cannot be resolved to a type

眉间皱痕 提交于 2019-12-08 13:02:41

问题


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 NotificationCompat 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


回答1:


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.



来源:https://stackoverflow.com/questions/32913702/appcompatactivity-cannot-be-resolved-to-a-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!