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 <alessandro.portale@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-10-20 12:15:06 +02:00
parent 89e16e8b8c
commit fecb6d50e5

View File

@@ -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