I see a lot of posts online, are written half, not specific enough, or do not fit, I tried a lot of myself, finally got the solution.
prerequisite
Android studio 3.5.1 track of
the JDK 1.8 com. The Android. View the build: gradle: 3.5.1 track of migration to the
project androidx strong> p>
step 1: check to see if build.gradle is configured
search build. If there is a keyword in gradle com. Android. Support: support - annotations code>
if not, you need to add configuration, the steps as shown in figure p>
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:support-annotations:28.0.0"
}
modifier error file
view the file with the error and modify the import package.
import android.support.annotation.IntDef;
import android.support.annotation.WorkerThread;
import androidx.annotation.IntDef;
import androidx.annotation.WorkerThread;
shortcut
Ctrl + Shift + R
import android. Support. The annotation. strong>
with
import androidx. The annotation. strong>