From f24a8b675a0b3d7e73870c46239792a31cf81491 Mon Sep 17 00:00:00 2001 From: Diego Perez Date: Wed, 6 Apr 2016 16:06:27 +0100 Subject: Use system property to detect Android --- src/java/com/jogamp/common/os/AndroidVersion.java | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/java/com/jogamp') diff --git a/src/java/com/jogamp/common/os/AndroidVersion.java b/src/java/com/jogamp/common/os/AndroidVersion.java index 840933f..c2c2159 100644 --- a/src/java/com/jogamp/common/os/AndroidVersion.java +++ b/src/java/com/jogamp/common/os/AndroidVersion.java @@ -74,15 +74,20 @@ public class AndroidVersion { Object abvObject= null; Class abvcClass = null; Object abvcObject= null; - try { - abClass = ReflectionUtil.getClass(androidBuild, true, cl); - abObject = abClass.newInstance(); - abvClass = ReflectionUtil.getClass(androidBuildVersion, true, cl); - abvObject = abvClass.newInstance(); - abvcClass = ReflectionUtil.getClass(androidBuildVersionCodes, true, cl); - abvcObject = abvcClass.newInstance(); - } catch (final Exception e) { /* n/a */ } - isAvailable = null != abObject && null != abvObject; + + boolean isDalvikVm = "Dalvik".equals(System.getProperty("java.vm.name")); + + if (isDalvikVm) { + try { + abClass = ReflectionUtil.getClass(androidBuild, true, cl); + abObject = abClass.newInstance(); + abvClass = ReflectionUtil.getClass(androidBuildVersion, true, cl); + abvObject = abvClass.newInstance(); + abvcClass = ReflectionUtil.getClass(androidBuildVersionCodes, true, cl); + abvcObject = abvcClass.newInstance(); + } catch (final Exception e) { /* n/a */ } + } + isAvailable = isDalvikVm && null != abObject && null != abvObject; if(isAvailable) { CPU_ABI = getString(abClass, abObject, "CPU_ABI", true); CPU_ABI2 = getString(abClass, abObject, "CPU_ABI2", true); -- cgit v1.2.3