Java Android Studio中不存在androidx.appcompat.widget包
我创建了一个扩展ImageView的自定义类。在AndroidX出现之前,它工作得非常好 这里是java代码Java Android Studio中不存在androidx.appcompat.widget包,java,android,imageview,androidx,Java,Android,Imageview,Androidx,我创建了一个扩展ImageView的自定义类。在AndroidX出现之前,它工作得非常好 这里是java代码 导入android.content.Context; 导入android.graphics.BitmapFactory; 导入android.util.Base64; 导入android.widget.RelativeLayout; 导入androidx.appcompat.widget.AppCompatImageView; 公共类CloseView扩展了AppCompatImageV
导入android.content.Context;
导入android.graphics.BitmapFactory;
导入android.util.Base64;
导入android.widget.RelativeLayout;
导入androidx.appcompat.widget.AppCompatImageView;
公共类CloseView扩展了AppCompatImageView{
公共关闭视图(上下文){
超级(上下文);
init();
}
...
Android显示此文件的2个错误
有人能解决这个问题吗?您应该完全迁移到AndroidX来使用它的类
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
见:
编辑:
AndroidX是所有以前编号的支持库的最新替代品。在开始使用之前,请阅读有关它的更多信息。您正在使用支持库,但正在尝试导入AndroidX软件包。请使用其中一个,而不是同时使用这两个软件包。在Gradle设置中启用AndroidX。请确保将其放在Gradle.properties中
android.useAndroidX=true
android.enableJetifier=true
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'