From fecb6d50e56a4966c990d58f83bd367c16a253a3 Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Thu, 20 Oct 2022 12:15:06 +0200 Subject: [PATCH] Android: Fix emulator tool path In cases where the obsolete "Android SDK Tools" package is installed in addition to the "Android SDK Command-line Tools", the older emulator launcher is called. One reason for that is that the obsolete package has a higher version number than the new one. This change resorts to checking the existence of the new emulator executable and falls back to the old one. Fixes: QTCREATORBUG-28196 Change-Id: I753e0901334a87314a2c8c70fbc69e55dffc500c Reviewed-by: Alessandro Portale --- src/plugins/android/androidconfigurations.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 72286ef819b..d5577deb142 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -471,10 +471,12 @@ FilePath AndroidConfig::adbToolPath() const FilePath AndroidConfig::emulatorToolPath() const { - QString relativePath = "emulator/emulator"; - if (sdkToolsVersion() < QVersionNumber(25, 3, 0) && preCmdlineSdkToolsInstalled()) - relativePath = "tools/emulator"; - return m_sdkLocation / (relativePath + QTC_HOST_EXE_SUFFIX); + const FilePath emulatorFile = m_sdkLocation.pathAppended("emulator/emulator") + .withExecutableSuffix(); + if (emulatorFile.exists()) + return emulatorFile; + + return m_sdkLocation.pathAppended("tools/emulator").withExecutableSuffix(); } FilePath AndroidConfig::sdkManagerToolPath() const