Sometimes android.os.Build might be in the classpath even if the system is not Android. This will cause the Android detection to fail. The recommended way to detect when an app is running on Android is using the "java.vm.name" system property and checking if the value is equals to "Dalvik".
Hi Does it work when Dalvik VM isn't used (i.e when Android Runtime is used instead)? How does the detection fail? Please can you be more accurate? Can you post a stack trace?
Yes, "Dalvik" will be returned even when using ART. The detection fails because android.os.Build might be sometimes in the classpath even if the system is not Android. In those cases, the library will incorrectly assume that is running in Android when it's not. The PR (https://github.com/sgothel/gluegen/pull/33/files) updates the detection to use the "java.vm.name" property.
Thank you Diego, merged.