forked from qt-creator/qt-creator
Android: Fix deployment to wrong avd
We used to only identify the avd by api level and abi. That was obviously incorrect, but at the time I didn't know how to get the actual avd name from a running emulator. Turns out this is reasonable easy via telnet on the emulator port. Change-Id: I387901a5294674f44399c0726abcc9feea221e8d Task-number: QTCREATORBUG-13095 Reviewed-by: BogDan Vatra <bogdan@kde.org>
This commit is contained in:
@@ -191,22 +191,17 @@ bool AndroidDeployQtStep::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_deviceAPILevel = AndroidManager::minimumSDK(target());
|
||||
int deviceAPILevel = AndroidManager::minimumSDK(target());
|
||||
AndroidConfigurations::Options options = AndroidConfigurations::None;
|
||||
if (androidBuildApkStep->deployAction() == AndroidBuildApkStep::DebugDeployment)
|
||||
options = AndroidConfigurations::FilterAndroid5;
|
||||
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(project(), m_deviceAPILevel, m_targetArch, options);
|
||||
if (info.serialNumber.isEmpty()) // aborted
|
||||
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(project(), deviceAPILevel, m_targetArch, options);
|
||||
if (info.serialNumber.isEmpty() && info.avdname.isEmpty()) // aborted
|
||||
return false;
|
||||
|
||||
if (info.type == AndroidDeviceInfo::Emulator) {
|
||||
m_avdName = info.serialNumber;
|
||||
m_serialNumber.clear();
|
||||
m_deviceAPILevel = info.sdk;
|
||||
} else {
|
||||
m_avdName.clear();
|
||||
m_serialNumber = info.serialNumber;
|
||||
}
|
||||
m_avdName = info.avdname;
|
||||
m_serialNumber = info.serialNumber;
|
||||
|
||||
AndroidManager::setDeviceSerialNumber(target(), m_serialNumber);
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
|
||||
@@ -278,7 +273,7 @@ bool AndroidDeployQtStep::init()
|
||||
|
||||
m_adbPath = AndroidConfigurations::currentConfig().adbToolPath().toString();
|
||||
|
||||
if (AndroidConfigurations::currentConfig().findAvd(m_deviceAPILevel, m_targetArch).isEmpty())
|
||||
if (AndroidConfigurations::currentConfig().findAvd(m_avdName).isEmpty())
|
||||
AndroidConfigurations::currentConfig().startAVDAsync(m_avdName);
|
||||
return true;
|
||||
}
|
||||
@@ -400,7 +395,7 @@ void AndroidDeployQtStep::slotSetSerialNumber(const QString &serialNumber)
|
||||
void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
|
||||
{
|
||||
if (!m_avdName.isEmpty()) {
|
||||
QString serialNumber = AndroidConfigurations::currentConfig().waitForAvd(m_deviceAPILevel, m_targetArch, fi);
|
||||
QString serialNumber = AndroidConfigurations::currentConfig().waitForAvd(m_avdName, fi);
|
||||
if (serialNumber.isEmpty()) {
|
||||
fi.reportResult(false);
|
||||
emit finished();
|
||||
|
||||
Reference in New Issue
Block a user