简体   繁体   English

Qt Creator Android 错误“已安装平台 SDK”

[英]Qt Creator Android error “Platform SDK installed”

I am developing Qt Cross platform application for Android, recently i have updated Qt creator and Installed new Qt version.我正在为 Android 开发 Qt 跨平台应用程序,最近我更新了 Qt 创建者并安装了新的 Qt 版本。 I am using 'Qt Creator version 4.5.0' .我正在使用'Qt Creator version 4.5.0' I have updated to 'QT version 5.10' .我已经更新到'QT version 5.10' This Set up is done on Ubuntu 16.04.此设置在 Ubuntu 16.04 上完成。

Followed link Getting Started with QT Installation .跟随链接QT 安装入门

I am always getting Error message "Android Settings have error" in Qt Creator->Tools->Options->Devices->Android.我总是在 Qt Creator->Tools->Options->Devices-> Android 中收到错误消息“Android 设置有错误”

QT Android 安装问题

Because of above issue i am not able to build application for Android.由于上述问题,我无法为 Android 构建应用程序。

I have recently updated my Android sdk, I am able to build and run Sample application from Android Studio, indicating that SDK instalation is working properly.我最近更新了我的 Android sdk,我能够从 Android Studio 构建和运行示例应用程序,这表明 SDK 安装工作正常。 I am using Android SDK tools 26.1.1.我正在使用 Android SDK 工具 26.1.1。 Please check bellow screen shots.请检查以下屏幕截图。

Android Studio SDK 管理器

Android SDK build tools Installed.已安装 Android SDK 构建工具。 在此处输入图片说明

Android SDk platforms installed已安装 Android SDK 平台在此处输入图片说明

Already gone through different links on Stack Overflow and QT forum, All are Suggesting downgrade of Android SDK tools(Due to QT Known bug), but none of the solution is working for me.已经通过 Stack Overflow 和 QT 论坛上的不同链接,都在建议降级 Android SDK 工具(由于 QT 已知错误),但没有一个解决方案对我有用。 I know there are few known bugs building Android application with QT 5.9 and Qt Creator version 4.0.我知道使用 QT 5.9 和 Qt Creator 4.0 版构建 Android 应用程序的已知错误很少。 I guess It is resolved, as same set up is working fine on Windows 10.我想它已解决,因为相同的设置在 Windows 10 上运行良好。

QT Creator wont list any available Android Build SDKs QT Android Installation error QT Creator 不会列出任何可用的 Android Build SDKs QT Android 安装错误

Please help if anybody here resolved same issue.如果这里有人解决了同样的问题,请帮忙。

I just found this bugreport , where in the comments can be found我刚刚发现这个bug报告,在评论那里可以找到

The native 'sdkmanager' tool can not update packages on windows and it fails with JDK 9 and these issues cascades to Qt Creator also.原生的“sdkmanager”工具无法更新 Windows 上的软件包,并且它在 JDK 9 上失败,这些问题也会级联到 Qt Creator。

I just tried installing JDK 8 and changing the path, and after reopening the settings menu it had worked!我只是尝试安装 JDK 8 并更改路径,在重新打开设置菜单后它已经工作了!

After lot of effort I am able to fix this issue, thanks to Mohammad Kanan, Vesafary who's answer made me get closer to Answer, Actual issue resolved with the following steps.经过大量努力,我能够解决这个问题,感谢 Mohammad Kanan,Vesafary 的回答让我更接近回答,通过以下步骤解决了实际问题。 It may be helpful who are facing the same issue In Ubuntu or may work on other platforms as well.在 Ubuntu 中遇到相同问题或者也可以在其他平台上工作的人可能会有所帮助。

  1. First Step is (as most of the answers suggest) changed from JDK 9 to JDK 8. I am using Java version "1.8.0_152" .第一步是(正如大多数答案所暗示的那样)从 JDK 9 更改为 JDK 8。我使用的是 Java 版本"1.8.0_152"
  2. Step 1 didn't help me (Qt creator Persist some Settings), so i removed complete Qt 5.8,5.9,5.10 installation (Using Qt Maintainace tool ) and following 2 links Uninstall Qt Completely , Uninstall Qt Creator .步骤 1 对我没有帮助(Qt creator Persist some Settings),所以我删除了完整的 Qt 5.8、5.9、5.10 安装(使用 QtMaintainace工具)和以下 2 个链接完全卸载 Qt卸载 Qt Creator

and did Instalation again.并再次安装。 May be your problem get resolved at this step.可能是你的问题在这一步得到解决。

  1. Step 2 also didn't help in my case, QT Creator still persist few settings and need to reset Qt creator settings.在我的情况下,第 2 步也没有帮助,QT Creator 仍然保留一些设置,需要重置 Qt Creator 设置。 That can be done by deleting data in this folder这可以通过删除此文件夹中的数据来完成

    ~/.config/QtProject ~/.config/Qt file ~/.config/QtProject.conf ~/.config/QtProject ~/.config/Qt 文件 ~/.config/QtProject.conf

path may be different in different System and OS.路径在不同的系统和操作系统中可能不同。 following links will be helpful in this case.在这种情况下,以下链接将有所帮助。

Creator FAQ创作者常见问题

Stack Overflow Qt Settings 1 堆栈溢出 Qt 设置 1

Stack Overflow Qt Settings 2 堆栈溢出 Qt 设置 2

Now i am able to build and run android application.现在我能够构建和运行 android 应用程序。

I am using the answer box to show you how it works for me, one last comment: I don't install NDK 16 .. try remove it from Android manager;我正在使用答案框向您展示它对我的工作方式,最后一条评论:我不安装 NDK 16 .. 尝试从 Android 管理器中删除它; while (For Qt) install seperately NDK 10e (this was a Qt recommendation already).而(对于 Qt)单独安装 NDK 10e(这已经是 Qt 推荐了)。 在此处输入图片说明

And Qt configuration side:和Qt配置端: 在此处输入图片说明

在此处输入图片说明

"Platform SDK installed" requires a working a sdkmanager command. “已安装平台 SDK”需要使用sdkmanager命令。

If you have the Platform SDK installed, try running the sdkmanager command directly.如果您安装了 Platform SDK,请尝试直接运行sdkmanager命令。

This is $ANDROID_SDK_ROOT/tools/bin/sdkmanager .这是$ANDROID_SDK_ROOT/tools/bin/sdkmanager On my Linux system this was in $HOME/Android/Sdk/tools/bin/sdkmanager .在我的 Linux 系统上,它位于$HOME/Android/Sdk/tools/bin/sdkmanager

The typically issue is典型的问题是

  • You need to install JDK 8 properly (note that JDK 9, JDK 10 and JDK 11 will not work!)您需要正确安装 JDK 8(请注意,JDK 9、JDK 10 和 JDK 11 将无法运行!)

If you have installed a newer JDK you will need to downgrade to JDK 8. Either OpenJDK or Oracle will work, but it needs to be JDK 8.如果您安装了较新的 JDK,则需要降级到 JDK 8。OpenJDK 或 Oracle 都可以,但必须是 JDK 8。

Work thru any remaining issues with the sdkmanager command line, then, once that's done, you should find Qt Creator to be happy again.使用sdkmanager命令行解决所有剩余问题,然后,一旦完成,您应该会发现 Qt Creator 再次感到高兴。

References:参考资料:

Thanks I had the same problem, using Debian Buster (sid) with QtCreator 4.6.2 with Qt5.10.1谢谢我遇到了同样的问题,在 QtCreator 4.6.2 和 Qt5.10.1 中使用 Debian Buster (sid)

Go into ~/.config and wipe all the qtcreator settings, then start again specifying jdk.8 then the paths to the Android SDK and then the NDK.进入 ~/.config 并擦除所有 qtcreator 设置,然后再次开始指定 jdk.8,然后是 Android SDK 的路径,然后是 NDK。

It then works and the dumb SDK platform not installed error does not occur.然后它就可以工作了,并且不会发生愚蠢的SDK 平台未安装错误 :) :)

Out of interest I tried wiping everything ~/.config/qtcreator* and then specifying jdk10.出于兴趣,我尝试擦除所有内容 ~/.config/qtcreator*,然后指定 jdk10。 Does not work as before.不像以前那样工作。

If you then change to jdk8, it still does not work.如果再换成jdk8,还是不行。 You have to close QtCreator, wipe all the configs, reopen and choose it again, whereon it will work.您必须关闭 QtCreator,擦除所有配置,重新打开并再次选择它,它将起作用。

you do not need to wipe the configs for qt.您不需要擦除 qt 的配置。 simply install the latest of jdk 8 from here -> http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html只需从这里安装最新的 jdk 8 -> http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

next select the jdk location in the options and then toward the bottom select the sdk manager tab.接下来在选项中选择 jdk 位置,然后在底部选择 sdk 管理器选项卡。 Click the update installed button and it should show a window with a list of licenses you need to agree to.单击更新安装按钮,它应该会显示一个窗口,其中包含您需要同意的许可证列表。

The problem lies with jdk 9 and up.问题在于 jdk 9 及更高版本。 For some odd reason it doesn't show the license agreements and doesn't continue beyond that point.出于某种奇怪的原因,它没有显示许可协议,也不会超出该点。 The fix is sticking with jdk8该修复程序坚持使用 jdk8

Linux: Linux:

The proposed solutions did not work for me.提出的解决方案对我不起作用。

I already had Java 8 and with Qt 5.12 installed the latest SDK and NDK are supposed to work (should work since Qt 5.9).我已经安装了 Java 8 并且安装了 Qt 5.12,最新的 SDK 和 NDK 应该可以工作(从 Qt 5.9 开始应该可以工作)。

After hours of fiddling, reinstalling Qt and Java, removing configs, downloading older NDKs and all, it still did not work.经过数小时的摆弄、重新安装 Qt 和 Java、删除配置、下载旧的 NDK 等等,它仍然无法正常工作。

My mistake was that I unpacked SDK and NDK as root into a read-only location for the user.我的错误是我以 root 身份将 SDK 和 NDK 解压到用户的只读位置。 After chown ing the folder to the my normal user, Creator found everything and worked as expected.将文件夹chown给我的普通用户后,Creator 找到了所有内容并按预期工作。

So also check, if the user running Qt Creator owns the folder containing SDK and NDK.因此还要检查,运行 Qt Creator 的用户是否拥有包含 SDK 和 NDK 的文件夹。 It's a quick check that might prevent you from deleting your configs.这是一个快速检查,可能会阻止您删除配置。 :) :)

Edit : In August 2019, I added a patch to Qt Creator, checking for this partiicular case and reporting an error accordingly.编辑:2019 年 8 月,我向 Qt Creator 添加了一个补丁,检查此特定情况并相应地报告错误。 https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=4ca3bd4d0f336f7055080e78849c0607ba99843c https://code.qt.io/cgit/qt-creator/qt-creator.git/commit/?id=4ca3bd4d0f336f7055080e78849c0607ba99843c

In my case I had red crosses for SDK tools installed.在我的情况下,我安装SDK 工具的红叉 and for Platform SDK installed.安装的平台 SDK。

To resolve it I needed to download android sdk tools fromhttps://androidsdkoffline.blogspot.com/p/android-sdk-tools.html要解决它,我需要从https://androidsdkoffline.blogspot.com/p/android-sdk-tools.html下载 android sdk 工具

file was tools_r25.2.5-linux.zip文件是 tools_r25.2.5-linux.zip

I placed extracted tools folder in sdk folder.我将提取的工具文件夹放在 sdk 文件夹中。 My setup now works only with open-jdk-8 Now I can deploy qml apps on my S10我的设置现在只适用于 open-jdk-8 现在我可以在我的 S10 上部署 qml 应用程序

I just had the exact same symptoms as the OP.我只是有与 OP 完全相同的症状。 Just that unlike the OP, I was using Qt Creator 4.8.0, as provided in the Ubuntu 19.10 repositories.与 OP 不同的是,我使用的是 Ubuntu 19.10 存储库中提供的 Qt Creator 4.8.0。

Symptoms症状

The relevant part from the Qt Creator self-check list is: Qt Creator 自检列表中的相关部分是:

✓  SDK tools installed.
X  Platform SDK installed.

An additional symptom was that the "SDK Manager" tab below had this message:另一个症状是下面的“SDK 管理器”选项卡有此消息:

SDK manager is not available with the current version of SDK tools. SDK 管理器不适用于当前版本的 SDK 工具。 Use Native SDK Manager.使用原生 SDK 管理器。

Cause and Fix原因和修复

The reason for this issue was a wrong version of SDK tools .此问题的原因是SDK 工具版本错误 That wrong version is recognized ("SDK tools installed.") but cannot be utilized by Qt Creator to detect which platform SDK is installed or to install new ones.该错误版本已被识别(“安装了 SDK 工具”),但 Qt Creator 无法利用它来检测安装了哪个平台 SDK 或安装新的 SDK。

In my case, I had simply downloaded the latest version, provided as commandlinetools-linux-*_latest.zip on the Android Studio download page .就我而言,我只是下载了最新版本,在Android Studio 下载页面上以commandlinetools-linux-*_latest.zip提供。 That version introduced changes that are not backwards compatible with the interface of earlier versions that Qt Creator is expecting.该版本引入了与 Qt Creator 期望的早期版本界面不向后兼容的更改。 That new package is indeed quite different: it has a different name ( commandlinetools vs. sdk-tools ), expects to be in a different place etc..这个新包确实有很大的不同:它有一个不同的名称( commandlinetoolssdk-tools ),预计在不同的地方等等。

To solve this, download and install "Android SDK Tools 26.1.1" (rev. 4333796) as follows, supplying your own Android SDK directory of course:要解决此问题,请按如下方式下载并安装“Android SDK Tools 26.1.1”(修订版 4333796),当然也提供您自己的 Android SDK 目录:

cd /opt/android-sdk/
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip

That fixed all the symptoms described above.这解决了上述所有症状。

OK, after many many hours try-out I finally find out how we can fix it.好的,经过许多小时的尝试,我终于找到了如何修复它。

  • Download and use Android NDK r10e separately (don't install it through SDK Manager)单独下载使用Android NDK r10e(不要通过SDK Manager安装)
  • Download and use Android SDK without Android Studio (download android tools from official site) Qt Preferences will installs all needed packages (build tools , platform tools, sdk tools, platform android-28)没有Android Studio 的情况下下载和使用 Android SDK(从官方网站下载 android 工具) Qt Preferences 将安装所有需要的包(构建工具、平台工具、sdk 工具、平台 android-28)
  • Install and use Java JDK 8 (not newer)安装和使用 Java JDK 8(不是更新的)

Please note that installing SDK packages through Android Studio will not be detectable by Qt请注意,通过 Android Studio 安装 SDK 包不会被 Qt 检测到

To add on to the accepted answer of needing JDK 8 - if you already have a newer version of Java running, you can easily install a standalone version 8 alongside it.添加到需要 JDK 8 的公认答案 - 如果您已经运行了较新版本的 Java,您可以轻松地安装一个独立版本 8。 Use the installer from https://adoptopenjdk.net/ and select v8.0.使用https://adoptopenjdk.net/ 中的安装程序并选择 v8.0。 Make sure to update your preferences to point to the Java 8 and things should work.确保更新您的首选项以指向 Java 8 并且一切正常。

In my case, I download the separate SDK download tool, android-sdk_r24.4.1-windows, and Installed the SDK again.就我而言,我下载了单独的 SDK 下载工具 android-sdk_r24.4.1-windows,然后再次安装了 SDK。 the Android SDK Platform-tools is a part of Android SDK Manager.and I resolved the problem. Android SDK Platform-tools 是 Android SDK Manager 的一部分。我解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Problems in setup QT for Android apps development: "SDK manager runs (requires exactly java 1.8)" and "Platform SDK Installed" - Problems in setup QT for Android apps development: "SDK manager runs (requires exactly java 1.8)" and "Platform SDK Installed" 使用Qt Creator为Android构建Qt应用程序时出错 - Error building Qt app for Android with Qt Creator qt-creator android部署错误 - qt-creator android deploy error 在Linux上为Qt Creator安装不带Studio的Android SDK - Install Android SDK without Studio on Linux for Qt Creator Android Studio 2.4错误:未安装platform-tools软件包,禁用SDK自动下载 - Android Studio 2.4 Error:platform-tools package is not installed and SDK auto-download is disabled 适用于 Android 的 Qt 创建者 - Qt creator for Android 适用于 Android + Gstreamer 的 Qt 创建者 - Qt creator for Android + Gstreamer 如何在调试模式下将Qt Creator中的--android-platform更改为不是android-1? - How can I change the --android-platform in Qt Creator to not be android--1 in debug mode? 更新Android 4.4的android sdk平台时出错 - Error updating android sdk platform for Android 4.4 Android 构建工具安装在“/Applications/ADT/sdk/platform-tools” - Android Build Tools installed at '/Applications/ADT/sdk/platform-tools'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM