Home > Back-end >  Is there a reason why OnePlus devices don't have the Build.VERSION.RELEASE_OR_CODENAME value
Is there a reason why OnePlus devices don't have the Build.VERSION.RELEASE_OR_CODENAME value

Time:07-10

The following code works on Samsung devices to get the Android version number: String buildVersionRelease = Build.VERSION.RELEASE_OR_CODENAME;

The same code returns this error on OnePlus devices (3T and 5T)

java.lang.NoSuchFieldError: No static field RELEASE_OR_CODENAME of type Ljava/lang/String; in class Landroid/os/Build$VERSION; or its superclasses (declaration of 'android.os.Build$VERSION' appears in /system/framework/framework.jar!classes2.dex)

CodePudding user response:

You can take it with just using release. You can't get it always because it's working by device situation(is rooted etc.). So if you want to get it below code should work:

Build.VERSION.RELEASE;
  • Related