如何使GlideApp与androidx兼容?

Kin*_*wus 2 android-studio androidx

我最近将我的应用程序从AppCompat迁移到Androidx,但现在GlideApp面临严重问题。每当我尝试构建项目时,它都会显示编译失败。

我尝试更改以下导入语句,

import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
Run Code Online (Sandbox Code Playgroud)

在构建文件夹中:

import androidx.annotation.CheckResult;
import androidx.annotation.NonNull;
Run Code Online (Sandbox Code Playgroud)

但是每当我重建它时,它只会重新生成以前的import语句并返回以下错误:

错误:程序包android.support.annotation不存在错误:找不到符号类NonNull

Kin*_*wus 5

通过annotationProcessor 'androidx.annotation:annotation:1.1.0'在应用程序build.gradle中添加我的依赖项,我找到了修复程序,并且能够毫无错误地构建项目。

从这里获得解决方案:https : //github.com/bumptech/glide/issues/3080#issuecomment-426331231