If Android support is enabled in MS VS2015, it installs Android SDK without Google Play Services and I did not find an option in SDK Manager that installs them. When I started “C:\Program Files (x86)\Android\android-sdk\SDK Manager.exe” with admin privileges, it automatically offered to install some 9 packages:
Including Google Play Services docs and samples:
But Google Play Services themselves were not installed, and there was no m2repository folder in “C:\Program Files (x86)\Android\android-sdk\extras\google\“.
I found the following links:
- Missing Google Play Services in SDK Manager
- Google Play Services Missing in Extras folder in SDK Manager
and installed Android Studio that, in its turn, installed new Android SDK to C:\Users\forester\AppData\Local\Android\Sdk folder that at least has m2repository\com\google\android\gms in extras\google.
Then I configured environment variables in QT Creator (previously they were C:\Program Files (x86)\Android\android-sdk):
and my Java code using Google Play Services started to compile, but at the same time “Buildfile: build.xml does not exist!” error started to happen while generating Android package in QT Creator. Links:
- ant build.xml file doesn’t exist
- Building Android projects in Qt doesn’t work anymore
- qt 5.5 android Compile Error
- Android: Qt 5.5 Compile time Error
Old Android SDK has folder “C:\Program Files (x86)\Android\android-sdk\tools\templates“, but the new one does not have tools\templates folder, so I tried to copy it from “C:\Program Files\Android\Android Studio\plugins\android\lib\templates” and from old SDK, but with no success.
After that I enabled Gradle in QT Creator:
and got some further errors:
FAILURE: Build failed with an exception. * Where: Build file 'D:\Repos\<path-to-my-project>\android-build\build.gradle' line: 17 * What went wrong: A problem occurred evaluating root project 'android-build'. > java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Links:
- Android Studio continues to get a Unsupported major.minor version 52.0
- Getting error when trying to run new project in Android Studio 2.2.1
- Install Java JDK 1.8 and change the JAVA_HOME
- Check your JAVA_HOME to use jdk 1.8
- Cannot set JAVA_HOME
My Java SDK previously was C:/Program Files (x86)/Java/jdk1.7.0_55 looks like I should update it to C:\Program Files\Java\jdk1.8.0_151.
After doing some further Google search I found a better way to specify JDK and Android SDK locations in Options->Devices:
After that I was unable to choose Android SDK version in project Build settings:
And build failed with the following errors:
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android-build'. > Failed to find Platform SDK with path: platforms;android-1
And again copying templates folder from “C:\Program Files\Android\Android Studio\plugins\android\lib\” to C:\Users\forester\AppData\Local\Android\Sdk\tools\ did not help.
Links:
- QT Creator wont list any available Android Build SDKs
- Building Android projects with Qt 5.8: SDK & build.xml
- Qt 5.9.1 : Android build SDK is empty
- Android: Update Qt Creator plugin to use the new Android SDK tools
- My post on QT form
I tried to set Android SDK version manually in .pro.user:
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.3"> <value type="QString" key="BuildTargetSdk">android-19</value> <value type="QString" key="KeystoreLocation"></value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build Android APK</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.AndroidBuildApkStep</value> <value type="int" key="Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction">2</value> <value type="bool" key="UseGradle">true</value> <value type="bool" key="VerboseOutput">false</value> </valuemap>
but still without success, QT Creator resets it when it starts. Currently I have 19 and 25 versions of SDK installed:
Android Studio version is 3.0.1.
My attempt to update QT with its Maintenance Tool failed probably because it does not have default repositories: