diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index 918a4e39770..1cd180efb98 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -487,20 +487,7 @@ bool AndroidBuildApkStep::init() return false; } - const QVersionNumber sdkToolsVersion = AndroidConfigurations::currentConfig().sdkToolsVersion(); - if (sdkToolsVersion >= QVersionNumber(25, 3, 0) - && AndroidConfigurations::currentConfig().preCmdlineSdkToolsInstalled()) { - if (!version->sourcePath().pathAppended("src/3rdparty/gradle").exists()) { - const QString error - = Tr::tr("The installed SDK tools version (%1) does not include Gradle " - "scripts. The minimum Qt version required for Gradle build to work " - "is %2") - .arg(sdkToolsVersion.toString()) - .arg("5.9.0/5.6.3"); - reportWarningOrError(error, Task::Error); - return false; - } - } else if (version->qtVersion() < QVersionNumber(5, 4, 0)) { + if (version->qtVersion() < QVersionNumber(5, 4, 0)) { const QString error = Tr::tr("The minimum Qt version required for Gradle build to work is %1. " "It is recommended to install the latest Qt version.") .arg("5.4.0"); diff --git a/src/plugins/android/androidconfigurations.cpp b/src/plugins/android/androidconfigurations.cpp index 0ed3c41f3ed..8c5b4c33249 100644 --- a/src/plugins/android/androidconfigurations.cpp +++ b/src/plugins/android/androidconfigurations.cpp @@ -451,21 +451,9 @@ QString AndroidConfig::apiLevelNameFor(const SdkPlatform *platform) QString("android-%1").arg(platform->apiLevel()) : ""; } -// This is checking for the SDK tools [*] that were deprecated in favor of -// the command-line tools. -// See https://developer.android.com/studio/releases/sdk-tools -bool AndroidConfig::preCmdlineSdkToolsInstalled() const -{ - QString toolPath("tools/bin/sdkmanager"); - if (HostOsInfo::isWindowsHost()) - toolPath += ANDROID_BAT_SUFFIX; - - return m_sdkLocation.pathAppended(toolPath).exists(); -} - FilePath AndroidConfig::adbToolPath() const { - return m_sdkLocation / "platform-tools/adb" QTC_HOST_EXE_SUFFIX; + return m_sdkLocation.pathAppended("platform-tools/adb").withExecutableSuffix(); } FilePath AndroidConfig::emulatorToolPath() const @@ -475,52 +463,31 @@ FilePath AndroidConfig::emulatorToolPath() const if (emulatorFile.exists()) return emulatorFile; - return m_sdkLocation.pathAppended("tools/emulator").withExecutableSuffix(); + return FilePath(); } FilePath AndroidConfig::sdkManagerToolPath() const { - const QStringList sdkmanagerPaths = { - QString(Constants::cmdlineToolsName).append("/latest/bin/sdkmanager"), - "tools/bin/sdkmanager"}; - - for (const QString &toolPath : sdkmanagerPaths) { - QString toolPathWithSuffix = toolPath; - if (HostOsInfo::isWindowsHost()) - toolPathWithSuffix += ANDROID_BAT_SUFFIX; - const FilePath sdkmanagerPath = m_sdkLocation / toolPathWithSuffix; - if (sdkmanagerPath.exists()) - return sdkmanagerPath; - } + const FilePath sdkmanagerPath = m_sdkLocation.pathAppended(Constants::cmdlineToolsName) + .pathAppended("latest/bin/sdkmanager" ANDROID_BAT_SUFFIX); + if (sdkmanagerPath.exists()) + return sdkmanagerPath; // If it's a first time install use the path of Constants::cmdlineToolsName temporary download - const FilePath tmpSdkPath = m_temporarySdkToolsPath; - if (!tmpSdkPath.isEmpty()) { - QString suffix = "bin/sdkmanager"; - if (HostOsInfo::isWindowsHost()) - suffix += ANDROID_BAT_SUFFIX; - const FilePath tmpsdkManagerPath = tmpSdkPath.pathAppended(suffix); - if (tmpsdkManagerPath.exists()) - return tmpsdkManagerPath; - } + const FilePath sdkmanagerTmpPath = m_temporarySdkToolsPath.pathAppended( + "/bin/sdkmanager" ANDROID_BAT_SUFFIX); + if (sdkmanagerTmpPath.exists()) + return sdkmanagerTmpPath; return FilePath(); } FilePath AndroidConfig::avdManagerToolPath() const { - const QStringList sdkmanagerPaths = { - QString(Constants::cmdlineToolsName).append("/latest/bin/avdmanager"), - "tools/bin/avdmanager"}; - - for (const QString &toolPath : sdkmanagerPaths) { - QString toolPathWithSuffix = toolPath; - if (HostOsInfo::isWindowsHost()) - toolPathWithSuffix += ANDROID_BAT_SUFFIX; - const FilePath sdkmanagerPath = m_sdkLocation / toolPathWithSuffix; - if (sdkmanagerPath.exists()) - return sdkmanagerPath; - } + const FilePath sdkmanagerPath = m_sdkLocation.pathAppended(Constants::cmdlineToolsName) + .pathAppended("/latest/bin/avdmanager" ANDROID_BAT_SUFFIX); + if (sdkmanagerPath.exists()) + return sdkmanagerPath; return FilePath(); } @@ -532,23 +499,15 @@ void AndroidConfig::setTemporarySdkToolsPath(const Utils::FilePath &path) FilePath AndroidConfig::sdkToolsVersionPath() const { - const QStringList sdkVersionPaths = { - QString(Constants::cmdlineToolsName).append("/latest/source.properties"), - "tools/source.properties"}; - - for (const QString &versionPath : sdkVersionPaths) { - const FilePath sdkVersionPath = m_sdkLocation / versionPath; - if (sdkVersionPath.exists()) - return sdkVersionPath; - } + const FilePath sdkVersionPaths = m_sdkLocation.pathAppended(Constants::cmdlineToolsName) + .pathAppended("/latest/source.properties"); + if (sdkVersionPaths.exists()) + return sdkVersionPaths; // If it's a first time install use the path of Constants::cmdlineToolsName temporary download - const FilePath tmpSdkPath = m_temporarySdkToolsPath; - if (!tmpSdkPath.isEmpty()) { - const FilePath sdkVersionPath = tmpSdkPath.pathAppended("source.properties"); - if (sdkVersionPath.exists()) - return sdkVersionPath; - } + const FilePath tmpSdkPath = m_temporarySdkToolsPath.pathAppended("source.properties"); + if (tmpSdkPath.exists()) + return tmpSdkPath; return FilePath(); } diff --git a/src/plugins/android/androidconfigurations.h b/src/plugins/android/androidconfigurations.h index 9042cc599bb..de604cef289 100644 --- a/src/plugins/android/androidconfigurations.h +++ b/src/plugins/android/androidconfigurations.h @@ -134,8 +134,6 @@ public: QString getProductModel(const QString &device) const; bool isConnected(const QString &serialNumber) const; - bool preCmdlineSdkToolsInstalled() const; - bool sdkFullyConfigured() const { return m_sdkFullyConfigured; } void setSdkFullyConfigured(bool allEssentialsInstalled) { m_sdkFullyConfigured = allEssentialsInstalled; } diff --git a/src/plugins/android/androidconstants.h b/src/plugins/android/androidconstants.h index 32dce4aeb4a..db5219a5a14 100644 --- a/src/plugins/android/androidconstants.h +++ b/src/plugins/android/androidconstants.h @@ -8,13 +8,11 @@ namespace Android { namespace Internal { - #ifdef Q_OS_WIN32 #define ANDROID_BAT_SUFFIX ".bat" #else #define ANDROID_BAT_SUFFIX "" #endif - } // namespace Internal namespace Constants { diff --git a/src/plugins/android/createandroidmanifestwizard.cpp b/src/plugins/android/createandroidmanifestwizard.cpp index 930ead0f576..b00ece58cb1 100644 --- a/src/plugins/android/createandroidmanifestwizard.cpp +++ b/src/plugins/android/createandroidmanifestwizard.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -289,8 +290,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles() if (m_copyGradle) { FilePath gradlePath = version->prefix() / "src/3rdparty/gradle"; - if (!gradlePath.exists()) - gradlePath = AndroidConfigurations::currentConfig().sdkLocation() / "tools/templates/gradle/wrapper"; + QTC_ASSERT(gradlePath.exists(), return); FileUtils::copyRecursively(gradlePath, m_directory, nullptr, copy); }