diff options
author | Sven Gothel <[email protected]> | 2019-03-26 22:07:55 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-03-26 22:07:55 +0100 |
commit | 5de3feb0bd0cefef7c72a989cc77fc99c3b8fbb7 (patch) | |
tree | 90cde45df0252aea65bed0bcef903965b441d2b6 /src/java/com/jogamp/common | |
parent | 39ea4790b66d5bad5fa6bb66eda8586ef4c4ca58 (diff) | |
parent | f24a8b675a0b3d7e73870c46239792a31cf81491 (diff) |
Merge pull request #33 from diegopl/bug_1300
Use system property to detect Android
Diffstat (limited to 'src/java/com/jogamp/common')
-rw-r--r-- | src/java/com/jogamp/common/os/AndroidVersion.java | 23 |
1 files changed, 14 insertions, 9 deletions
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); |