public abstract class AndroidSupport
extends Object
Detects whether the runtime is Android's ART (or its Dalvik predecessor), where classes cannot be defined at run time and parts of the JDK class library are absent.
The VM name is the primary signal: Android reports java.vm.name as
"Dalvik" on every release to date. A JVM merely carrying Android
classes on its class path, as Robolectric tests do, is not Android and keeps
the JVM behaviour. The framework's Activity class is consulted only
when the property cannot be read (GROOVY-12384).
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static boolean |
isRunningAndroid()Whether this runtime was detected as Android. |
Whether this runtime was detected as Android. The answer is computed once:
java.vm.name starting with "Dalvik" means Android. If that
property cannot be read, the answer is whether android.app.Activity
can be loaded by this class's loader.
true when the runtime was detected as Android