How can I detect the Android runtime (Dalvik or ART)?

前端 未结 6 1115
长情又很酷
长情又很酷 2021-01-30 13:22

Google added a new ART runtime with Android 4.4. How can I determine whether ART or Dalvik is the current runtime?

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 13:56

    final String vm = VMRuntime.getRuntime().vmLibrary();

    and then compare vm with "libdvm.so" or "libart.so" to check if it is Dalvik or ART.

    Reference: https://gitorious.org/cyandreamproject/android_frameworks_base/commit/4c3f1e9e30948113b47068152027676172743eb1

提交回复
热议问题