[英]Can't import package android.support.v7.app (error: does not exist)
I tried looking into topics that already are on this site, but I couldn't fix my problem based on that and neither did authors I think.我尝试查看本网站上已有的主题,但我无法解决我的问题,我认为作者也没有。
I am trying to import android.support.v7.app.NotificationCompat
.我正在尝试import android.support.v7.app.NotificationCompat
。
I am new to this and I have been trying to get Android Studio to work, I am done with 1 project and after starting another I am stuck immediately with this:我是新手,我一直在尝试让 Android Studio 工作,我完成了 1 个项目,在开始另一个项目后,我立即陷入困境:
error: package android.support.v7.app does not exist错误:包 android.support.v7.app 不存在
You need to: import androidx.appcompat.app.AppCompatActivity
.您需要: import androidx.appcompat.app.AppCompatActivity
。
Use it in the class the requires it eg MainActivity.在需要它的类中使用它,例如 MainActivity。
You should also have eg : implementation 'androidx.appcompat:appcompat:1.0.2'
你还应该有例如: implementation 'androidx.appcompat:appcompat:1.0.2'
If you don't want to change any code, just add the com.android.support
version:如果您不想更改任何代码,只需添加com.android.support
版本:
implementation "com.android.support:appcompat-v7:28.0.0"
However, as @Will suggested, using androidx
is rather the current way to do it.但是,正如@Will 所建议的那样,使用androidx
是目前的做法。 androidx.appcompat:appcompat:1.1.0
is alike 29.1.0
(which doesn't exist). androidx.appcompat:appcompat:1.1.0
与29.1.0
类似(不存在)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.