android build error: can't find symbol class IntDef

VK1 :

Using Android Studio to build the android version of a react native app. I just received

'error: cannot find symbol class IntDef'

It's used in the following code:

@IntDef(flag = true, value = { Information.BATTERY, Information.RSSI, Information.API_VERSION, Information.LED,
            Information.APPLICATION_VERSION })

the bottom of my dependencies block looks like this:

    implementation 'androidx.multidex:multidex:2.0.0'
    implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.0'

Do I need to make an import at the top of this file..or is do I need to add to the build.gradle such as implementation 'androidx.appcompat:appcompat:1.0.0'

inside the dependencies block?

I had the same issues except it was with ArrayMap, this was fixed by adding

compile "com.android.support:support-core-utils:24.2.0"

in the dependencies

Ashish :

You probably will have to include the following in your build.gradle file:

dependencies {
    implementation 'com.android.support:support-annotations:28.0.0'
}

And the import statement in your class would be such :

import android.support.annotation.IntDef;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=123326&siteId=1