我创建了一个扩展ImageView的自定义类。在AndroidX出现之前,它工作得非常好。
在这里,java代码
import android.content.Context;
import android.graphics.BitmapFactory;
import android.util.Base64;
import android.widget.RelativeLayout;
import androidx.appcompat.widget.AppCompatImageView;
public class CloseView extends AppCompatImageView {
public CloseView(Context context) {
super(context);
init();
}
...
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Android为此文件显示2个错误
有没有人能解决这个问题?
您应该完全迁移到AndroidX以使用它的类
AndroidX
: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'
见:https://developer.android.com/jetpack/androidx/migrate
编辑:
AndroidX是所有以前编号的支持库的最新替代品。在开始使用here之前,请阅读更多相关信息。