nstudio / nativescript-audio

:microphone: NativeScript plugin to record and play audio :musical_note:
Other
149 stars 104 forks source link

Android: To support older SDKs, don't use android.os.Build.VERSION_CODES #186

Closed StevenGBrown closed 3 years ago

StevenGBrown commented 3 years ago

When running Android prior to Oreo, android.os.Build.VERSION_CODES.O does not exist at runtime and so trying to use it produces an error. Instead, use the API level number (26) directly.

The VERSION_CODES work in Java code because the compiler replaces them with the numbers at build time, but that doesn't happen with JavaScript.

StevenGBrown commented 3 years ago
An uncaught Exception occurred on "main" thread.
Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function 
Error: java.lang.NoSuchFieldError: no "I" field "O" in class "Landroid/os/Build$VERSION_CODES;" or its superclasses
StevenGBrown commented 3 years ago

You're welcome! Thank you for the quick turnaround.