diff --git a/src/plugins/android/androidsettingswidget.cpp b/src/plugins/android/androidsettingswidget.cpp index 8d1beec12e93079283b9f887b9f05e4f172053b1..de2894c5dfce88cb91ffe7bdb24e2f6f4fa612de 100644 --- a/src/plugins/android/androidsettingswidget.cpp +++ b/src/plugins/android/androidsettingswidget.cpp @@ -155,20 +155,10 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode) { if (mode & Sdk) { m_sdkState = Okay; - if (m_androidConfig.sdkLocation().isEmpty()) { + if (m_androidConfig.sdkLocation().isEmpty()) m_sdkState = NotSet; - } else { - Utils::FileName adb = m_androidConfig.sdkLocation(); - Utils::FileName androidExe = m_androidConfig.sdkLocation(); - Utils::FileName androidBat = m_androidConfig.sdkLocation(); - Utils::FileName emulator = m_androidConfig.sdkLocation(); - if (!adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists() - || (!androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists() - && !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists()) - || !emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()) { - m_sdkState = Error; - } - } + else if (!(sdkLocationIsValid() && sdkPlatformToolsInstalled())) + m_sdkState = Error; } if (mode & Ndk) { @@ -241,7 +231,10 @@ void AndroidSettingsWidget::applyToUi(AndroidSettingsWidget::Mode mode) m_ui->sdkWarningIconLabel->setVisible(true); m_ui->sdkWarningLabel->setVisible(true); Utils::FileName location = Utils::FileName::fromUserInput(m_ui->SDKLocationLineEdit->text()); - m_ui->sdkWarningLabel->setText(tr("\"%1\" does not seem to be an Android SDK top folder.").arg(location.toUserOutput())); + if (sdkLocationIsValid()) + m_ui->sdkWarningLabel->setText(tr("The Platform tools are missing. Please use the Android SDK Manager to install them.")); + else + m_ui->sdkWarningLabel->setText(tr("\"%1\" does not seem to be an Android SDK top folder.").arg(location.toUserOutput())); } else { m_ui->sdkWarningIconLabel->setVisible(false); m_ui->sdkWarningLabel->setVisible(false); @@ -300,6 +293,22 @@ void AndroidSettingsWidget::applyToUi(AndroidSettingsWidget::Mode mode) } } +bool AndroidSettingsWidget::sdkLocationIsValid() const +{ + Utils::FileName androidExe = m_androidConfig.sdkLocation(); + Utils::FileName androidBat = m_androidConfig.sdkLocation(); + Utils::FileName emulator = m_androidConfig.sdkLocation(); + return (androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists() + || androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists()) + && emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists(); +} + +bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const +{ + Utils::FileName adb = m_androidConfig.sdkLocation(); + return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists(); +} + void AndroidSettingsWidget::saveSettings() { sdkLocationEditingFinished(); diff --git a/src/plugins/android/androidsettingswidget.h b/src/plugins/android/androidsettingswidget.h index eebd20d1637dddee9aa341374e07e203c6169cb1..5e6fb1238d14695c8b9ff3ccb2cb930956b12a56 100644 --- a/src/plugins/android/androidsettingswidget.h +++ b/src/plugins/android/androidsettingswidget.h @@ -98,6 +98,8 @@ private: enum State { NotSet = 0, Okay = 1, Error = 2 }; void check(Mode mode); void applyToUi(Mode mode); + bool sdkLocationIsValid() const; + bool sdkPlatformToolsInstalled() const; State m_sdkState; State m_ndkState;