6

Getting cannot resolve symbol nullable error for my program. @androidx.annotations.Nullable - nullable has redline under it.

package com.singularity.birdjumper;

import android.app.Activity;
import android.os.Bundle;

public class GameActivity extends Activity
{
    @Override
    protected void onCreate(@androidx.annotation.Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
}
john smith
  • 77
  • 1
  • 1
  • 9

3 Answers3

9

just add this import statement

import android.support.annotation.Nullable;

For androidx, the import statement should be:

import androidx.annotation.Nullable;
Bala Ganesh
  • 1,025
  • 1
  • 12
  • 23
5

Are you using the AndroidX library? It would be worth adding them into the app gradle file,

//set the version to latest version
implementation 'androidx.appcompat:appcompat:1.1.0-rc01' 

There is also a great answer over here for more information on AndroidX and migrating your projects over to it.

Android Studio adds both @androidx.annotation and @android.support.annotation problem

Ananth
  • 2,597
  • 1
  • 29
  • 39
justamarkprime
  • 101
  • 1
  • 11
0

i hava the same problem, sync project with gradle files or update gradle plug