Getting Runtime in Android Not bringing the right runtime
<p>I'm trying to get the runtime in my device, I've tested the following methods in 2 devices, Xperia Z1, Note 4.</p>

<p>The following codes I've tried :</p>

<pre><code>private String getIsArtInUse() {
return System.getProperty("java.vm.version");
}
</code></pre>

<p>This code returns 2.1, As some stackoverflow answers say, version greater than 2.0 means it's ART, but my runtime is Dalvik.</p>

<pre><code>private CharSequence getCurrentRuntimeValue() {
private static final String SELECT_RUNTIME_PROPERTY = "persist.sys.dalvik.vm.lib";
private static final String LIB_DALVIK = "libdvm.so";
private static final String LIB_ART = "libart.so";
private static final String LIB_ART_D = "libartd.so";
    try {
        Class&lt;?&gt; systemProperties = Class.forName("android.os.SystemProperties");
        try {
            Method get = systemProperties.getMethod("get",
               String.class, String.class);
            if (get == null) {
                return "WTF?!";
            }
        try {
            final String value = (String)get.invoke(
                systemProperties, SELECT_RUNTIME_PROPERTY,
                    /* Assuming default is */"Dalvik");
            if (LIB_DALVIK.equals(value)) {
                    return "Dalvik";
                } else if (LIB_ART.equals(value)) {
                    return "ART";
                } else if (LIB_ART_D.equals(value)) {
                    return "ART debug build";
            }

          return value;
        } catch (IllegalAccessException e) {
                return "IllegalAccessException";
        } catch (IllegalArgumentException e) {
                return "IllegalArgumentException";
        } catch (InvocationTargetException e) {
                return "InvocationTargetException";
        }
        } catch (NoSuchMethodException e) {
          return "SystemProperties.get(String key, String def) method is not found";
        }
        } catch (ClassNotFoundException e) {
          return "SystemProperties class is not found";
    }
}
</code></pre>

<p>This code returns Dalvik, always.</p>

<pre><code>public String getRuntime()
{ 
return System.getProperty("java.vm.name");
}
</code></pre>

<p>The following also returns Dalvik, but i don't think it returns the exact applied runtime .</p>

<p>Any suggestions ? </p>