forked from qt-creator/qt-creator
Android: Make Bundle Qt Deployment the default deployment method.
Debug Deployment broke with Android 5. Also show Android 5 devices as incompatible in the device dialog if we are using debug deployment. Task-number: QTCREATORBUG-13419 Change-Id: Ic321cfa46eb724f87f338af9c4b50face06c7c06 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com> Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
@@ -72,10 +72,8 @@ AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent,
|
||||
m_buildTargetSdk(AndroidConfig::apiLevelNameFor(AndroidConfigurations::currentConfig().highestAndroidSdk()))
|
||||
{
|
||||
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
||||
if (version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0)) {
|
||||
m_deployAction = DebugDeployment;
|
||||
if (version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0))
|
||||
m_useGradle = AndroidConfigurations::currentConfig().useGrandle();
|
||||
}
|
||||
//: AndroidBuildApkStep default display name
|
||||
setDefaultDisplayName(tr("Build Android APK"));
|
||||
}
|
||||
@@ -159,12 +157,7 @@ void AndroidBuildApkStep::processFinished(int exitCode, QProcess::ExitStatus sta
|
||||
|
||||
bool AndroidBuildApkStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
AndroidDeployAction defaultDeploy = BundleLibrariesDeployment;
|
||||
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
||||
if (version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0))
|
||||
defaultDeploy = DebugDeployment;
|
||||
|
||||
m_deployAction = AndroidDeployAction(map.value(DeployActionKey, defaultDeploy).toInt());
|
||||
m_deployAction = AndroidDeployAction(map.value(DeployActionKey, BundleLibrariesDeployment).toInt());
|
||||
if ( m_deployAction == DebugDeployment
|
||||
&& QtSupport::QtKitInformation::qtVersion(target()->kit())->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
|
||||
m_deployAction = BundleLibrariesDeployment;
|
||||
|
@@ -139,6 +139,9 @@
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../coreplugin/core.qrc">:/core/images/error.png</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -150,7 +153,8 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Signing an APK that uses "Deploy local Qt libraries" is not allowed</string>
|
||||
<string>Signing an APK that uses "Deploy local Qt libraries" is not allowed.
|
||||
Deploying local Qt libraries is incompatible with Android 5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@@ -989,7 +989,9 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
|
||||
emit m_instance->updated();
|
||||
}
|
||||
|
||||
AndroidDeviceInfo AndroidConfigurations::showDeviceDialog(ProjectExplorer::Project *project, int apiLevel, const QString &abi)
|
||||
AndroidDeviceInfo AndroidConfigurations::showDeviceDialog(ProjectExplorer::Project *project,
|
||||
int apiLevel, const QString &abi,
|
||||
Options options)
|
||||
{
|
||||
QString serialNumber = defaultDevice(project, abi);
|
||||
if (!serialNumber.isEmpty()) {
|
||||
@@ -1005,7 +1007,7 @@ AndroidDeviceInfo AndroidConfigurations::showDeviceDialog(ProjectExplorer::Proje
|
||||
return info;
|
||||
}
|
||||
|
||||
AndroidDeviceDialog dialog(apiLevel, abi, Core::ICore::mainWindow());
|
||||
AndroidDeviceDialog dialog(apiLevel, abi, options, Core::ICore::mainWindow());
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
AndroidDeviceInfo info = dialog.device();
|
||||
if (dialog.saveDeviceSelection()) {
|
||||
|
@@ -208,7 +208,8 @@ public:
|
||||
static AndroidConfigurations *instance();
|
||||
|
||||
static void updateAndroidDevice();
|
||||
static AndroidDeviceInfo showDeviceDialog(ProjectExplorer::Project *project, int apiLevel, const QString &abi);
|
||||
enum Options { None, FilterAndroid5 };
|
||||
static AndroidDeviceInfo showDeviceDialog(ProjectExplorer::Project *project, int apiLevel, const QString &abi, Options options);
|
||||
static void setDefaultDevice(ProjectExplorer::Project *project, const QString &abi, const QString &serialNumber); // serial number or avd name
|
||||
static QString defaultDevice(ProjectExplorer::Project *project, const QString &abi); // serial number or avd name
|
||||
public slots:
|
||||
|
@@ -176,8 +176,19 @@ bool AndroidDeployQtStep::init()
|
||||
emit addOutput(tr("No Android arch set by the .pro file."), ErrorOutput);
|
||||
return false;
|
||||
}
|
||||
|
||||
AndroidBuildApkStep *androidBuildApkStep
|
||||
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target()->activeBuildConfiguration());
|
||||
if (!androidBuildApkStep) {
|
||||
emit addOutput(tr("Cannot find the android build step."), ErrorOutput);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_deviceAPILevel = AndroidManager::minimumSDK(target());
|
||||
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(project(), m_deviceAPILevel, m_targetArch);
|
||||
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
|
||||
return false;
|
||||
|
||||
@@ -205,12 +216,6 @@ bool AndroidDeployQtStep::init()
|
||||
ProjectExplorer::ProcessParameters *pp = processParameters();
|
||||
m_useAndroiddeployqt = version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
|
||||
if (m_useAndroiddeployqt) {
|
||||
AndroidBuildApkStep *androidBuildApkStep
|
||||
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target()->activeBuildConfiguration());
|
||||
if (!androidBuildApkStep) {
|
||||
emit addOutput(tr("Cannot find the android build step."), ErrorOutput);
|
||||
return false;
|
||||
}
|
||||
Utils::FileName tmp = AndroidManager::androidQtSupport(target())->androiddeployqtPath(target());
|
||||
if (tmp.isEmpty()) {
|
||||
emit addOutput(tr("Cannot find the androiddeployqt tool."), ErrorOutput);
|
||||
|
@@ -213,7 +213,7 @@ public:
|
||||
class AndroidDeviceModel : public QAbstractItemModel
|
||||
{
|
||||
public:
|
||||
AndroidDeviceModel(int apiLevel, const QString &abi);
|
||||
AndroidDeviceModel(int apiLevel, const QString &abi, AndroidConfigurations::Options options);
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const;
|
||||
QModelIndex parent(const QModelIndex &child) const;
|
||||
@@ -229,6 +229,7 @@ public:
|
||||
private:
|
||||
int m_apiLevel;
|
||||
QString m_abi;
|
||||
AndroidConfigurations::Options m_options;
|
||||
AndroidDeviceModelNode *m_root;
|
||||
};
|
||||
|
||||
@@ -237,8 +238,8 @@ private:
|
||||
/////////////////
|
||||
// AndroidDeviceModel
|
||||
/////////////////
|
||||
AndroidDeviceModel::AndroidDeviceModel(int apiLevel, const QString &abi)
|
||||
: m_apiLevel(apiLevel), m_abi(abi), m_root(0)
|
||||
AndroidDeviceModel::AndroidDeviceModel(int apiLevel, const QString &abi, AndroidConfigurations::Options options)
|
||||
: m_apiLevel(apiLevel), m_abi(abi), m_options(options), m_root(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -347,6 +348,8 @@ void AndroidDeviceModel::setDevices(const QVector<AndroidDeviceInfo> &devices)
|
||||
} else if (device.sdk < m_apiLevel) {
|
||||
error = AndroidDeviceDialog::tr("API Level of device is: %1.")
|
||||
.arg(device.sdk);
|
||||
} else if (device.sdk > 20 && (m_options & AndroidConfigurations::FilterAndroid5)) {
|
||||
error = AndroidDeviceDialog::tr("Android 5 devices are incompatible with deploying Qt to a temporary directory.");
|
||||
} else {
|
||||
new AndroidDeviceModelNode(compatibleDevices, device);
|
||||
continue;
|
||||
@@ -386,9 +389,9 @@ static inline QString msgAdbListDevices()
|
||||
return AndroidDeviceDialog::tr("<p>The adb tool in the Android SDK lists all connected devices if run via "adb devices".</p>");
|
||||
}
|
||||
|
||||
AndroidDeviceDialog::AndroidDeviceDialog(int apiLevel, const QString &abi, QWidget *parent) :
|
||||
AndroidDeviceDialog::AndroidDeviceDialog(int apiLevel, const QString &abi, AndroidConfigurations::Options options, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_model(new AndroidDeviceModel(apiLevel, abi)),
|
||||
m_model(new AndroidDeviceModel(apiLevel, abi, options)),
|
||||
m_ui(new Ui::AndroidDeviceDialog),
|
||||
m_apiLevel(apiLevel),
|
||||
m_abi(abi)
|
||||
|
@@ -52,7 +52,7 @@ class AndroidDeviceDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AndroidDeviceDialog(int apiLevel, const QString &abi, QWidget *parent = 0);
|
||||
explicit AndroidDeviceDialog(int apiLevel, const QString &abi, AndroidConfigurations::Options opts, QWidget *parent = 0);
|
||||
~AndroidDeviceDialog();
|
||||
|
||||
AndroidDeviceInfo device();
|
||||
|
@@ -479,7 +479,7 @@ void AndroidManager::cleanLibsOnDevice(ProjectExplorer::Target *target)
|
||||
if (targetArch.isEmpty())
|
||||
return;
|
||||
int deviceAPILevel = AndroidManager::minimumSDK(target);
|
||||
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(target->project(), deviceAPILevel, targetArch);
|
||||
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(target->project(), deviceAPILevel, targetArch, AndroidConfigurations::None);
|
||||
if (info.serialNumber.isEmpty()) // aborted
|
||||
return;
|
||||
|
||||
@@ -509,7 +509,7 @@ void AndroidManager::installQASIPackage(ProjectExplorer::Target *target, const Q
|
||||
if (targetArch.isEmpty())
|
||||
return;
|
||||
int deviceAPILevel = AndroidManager::minimumSDK(target);
|
||||
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(target->project(), deviceAPILevel, targetArch);
|
||||
AndroidDeviceInfo info = AndroidConfigurations::showDeviceDialog(target->project(), deviceAPILevel, targetArch, AndroidConfigurations::None);
|
||||
if (info.serialNumber.isEmpty()) // aborted
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user