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

前端 未结 6 1106
长情又很酷
长情又很酷 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条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 14:03

    A simple solution :

    String vm = System.getProperty("java.vm.name") + " " + System.getProperty("java.vm.version");
    

    On my Android 8.0 (API 26) phone, it returns Dalvik 2.1.0 .

提交回复
热议问题