diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
index d86275f734c15c899c12e4c6955746da3162f329..a294b51b95750abbf4a9ade0383833295d6dc03f 100644
--- a/src/androiddeployqt/main.cpp
+++ b/src/androiddeployqt/main.cpp
@@ -139,6 +139,7 @@ struct Options
 
     // External tools
     QString sdkPath;
+    QString sdkBuildToolsVersion;
     QString ndkPath;
     QString antTool;
     QString jdkPath;
@@ -650,12 +651,19 @@ bool readInputFile(Options *options)
                 return false;
         } else {
             if (!QDir(options->sdkPath + QLatin1String("/platforms/") + options->androidPlatform).exists()) {
-                fprintf(stderr, "Warning: Android platform '%s' does not exist in NDK.\n",
+                fprintf(stderr, "Warning: Android platform '%s' does not exist in SDK.\n",
                         qPrintable(options->androidPlatform));
             }
         }
     }
 
+    {
+
+        QJsonValue value = jsonObject.value("sdkBuildToolsRevision");
+        if (!value.isUndefined())
+            options->sdkBuildToolsVersion = value.toString();
+    }
+
     {
         QJsonValue qtInstallDirectory = jsonObject.value("qt");
         if (qtInstallDirectory.isUndefined()) {
@@ -1596,6 +1604,18 @@ bool readDependencies(Options *options)
     if (!readDependenciesFromElf(options, options->applicationBinary, &usedDependencies, &remainingDependencies))
         return false;
 
+    // Until we have support non-gui applications on Android, always add Qt Gui
+    // as a dependency (otherwise the platform plugin cannot be deployed, and
+    // the application will not run).
+    QLatin1String guiLib("lib/libQt5Gui.so");
+    if (!usedDependencies.contains(guiLib)) {
+        QtDependency dep(guiLib, options->qtInstallDirectory + QLatin1Char('/') + guiLib);
+        options->qtDependencies.append(dep);
+        usedDependencies.insert(guiLib);
+        if (!readAndroidDependencyXml(options, QLatin1String("Qt5Gui"), &usedDependencies, &remainingDependencies))
+            return false;
+    }
+
     QString qtDir = options->qtInstallDirectory + QLatin1Char('/');
 
     while (!remainingDependencies.isEmpty()) {
@@ -2311,8 +2331,14 @@ bool signPackage(const Options &options)
 #endif
 
     if (!QFile::exists(zipAlignTool)) {
-        fprintf(stderr, "zipalign tool not found: %s\n", qPrintable(zipAlignTool));
-        return false;
+        zipAlignTool = options.sdkPath + QLatin1String("/build-tools/") + options.sdkBuildToolsVersion + QLatin1String("/zipalign");
+#if defined(Q_OS_WIN32)
+        zipAlignTool += QLatin1String(".exe");
+#endif
+        if (!QFile::exists(zipAlignTool)) {
+            fprintf(stderr, "zipalign tool not found: %s\n", qPrintable(zipAlignTool));
+            return false;
+        }
     }
 
     zipAlignTool = QString::fromLatin1("%1%2 -f 4 %3 %4")
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index 9996fd3bb0d394bdd1abdbd614027ffb8b310877..2b063a6db62677ba3d1a607403bdab6b33f0a161 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -710,6 +710,24 @@ void deployQmlImports(const QString &appBundlePath, QStringList &qmlDirs)
         QJsonObject import = importValue.toObject();
         QString name = import["name"].toString();
         QString path = import["path"].toString();
+        QString type = import["type"].toString();
+
+        LogNormal() << "Deploying QML import" << name;
+
+        // Skip imports with missing info - path will be empty if the import is not found.
+        if (name.isEmpty() || path.isEmpty()) {
+            LogNormal() << "  Skip import: name or path is empty";
+            LogNormal() << "";
+            continue;
+        }
+
+        // Deploy module imports only, skip directory (local/remote) and js imports. These
+        // should be deployed as a part of the application build.
+        if (type != QStringLiteral("module")) {
+            LogNormal() << "  Skip non-module import";
+            LogNormal() << "";
+            continue;
+        }
 
         // Create the destination path from the name
         // and version (grabbed from the source path)