Kartik Shandilya
Kartik Shandilya

Reputation: 3924

Unknow Class android.os.Build.VERSION

I'm using the version handling and conditioning it but getting an error as:

Unknown Class 'android.os.Build.VERSION.SDK_INT'

This is my code:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
   //TODO
}

Upvotes: 1

Views: 2199

Answers (2)

Kartik Shandilya
Kartik Shandilya

Reputation: 3924

Well, I updated my Android Studio and other SDK Tools and now it works fine. Maybe a wrong configuration or a file change caused the issue.

Upvotes: 0

draksi
draksi

Reputation: 83

I had this problem and fixed it by moving the code into the onCreate method of the activity.

Upvotes: 3

Related Questions