Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To resolve the symbol error "NonNull" in Android Studio:

  1. Make sure that you have added the necessary dependencies in your project's build.gradle file. The NonNull annotation is part of the AndroidX annotations library, so you need to make sure that you have added the following dependency to your app level build.gradle:

    implementation 'androidx.annotation:annotation:1.1.0'
    
  2. Clean and rebuild your project by selecting "Build" > "Clean Project" and then "Build" > "Rebuild Project" from the Android Studio menu.

  3. If you are still getting the error, try invalidating the cache and restarting Android Studio. You can do this by selecting "File" > "Invalidate Caches/Restart" from the Android Studio menu.

  4. If none of these steps work, check that you are using the correct import statement for the NonNull annotation. The correct import statement is:

    import androidx.annotation.NonNull;
    

    If you are using a different import statement, try changing it to the correct one.