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

前端 未结 6 1227
长情又很酷
长情又很酷 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 13:55

    The Android docs actually give the following suggestion:

    You can verify which runtime is in use by calling System.getProperty("java.vm.version"). If ART is in use, the property's value is "2.0.0" or higher.

    This seems accurate on my Nexus 4 w/ ART enabled (running Android 4.4.4). Nexus 5 on Dalvik returned 1.6.0.

提交回复
热议问题