3

Android runtime (ART) по умолчанию на устройствах Android 5.0 (API 21) и выше.

Как можно определить текущий runtime на устройстве (Dalvik или ART)?

1 ответ 1

5

Согласно документации

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.

Можно воспользоваться конструкцией из следующего ответа

private boolean getIsArtInUse() {
    final String vmVersion = System.getProperty("java.vm.version");
    return vmVersion != null && vmVersion.startsWith("2");
}

...

Log.i("log", "runtime -  ART - " + getIsArtInUse());

На выходе

I/log: runtime -  ART - false     //API < 21
I/log: runtime -  ART - true      //API => 21

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.