Tag Archives: android.support

[Solved] Android Error: import android.support.annotation.NonNull

I: problem description

I got an Android project in 2018. The error message of a java file in the project is as follows

import android.support.annotation.NonNull

The exception occurred when introducing Android support, because most Android projects now use Android x to replace the past Android support library, but it depends on the demand. Let’s talk about how to solve this problem on older Android projects.

II: solution

Copy the following line of code to replace the error code

import androidx.annotation.NonNull;