I am trying to compile an application for Android via QTCreator. In particular a toolkit Qt 5.12.10 Clang arm64-v8a
I got this error message:
In file included from C:/Qt/5.12.10/android_arm64_v8a/include/QtCore\QObject:1:
In file included from C:/Qt/5.12.10/android_arm64_v8a/include/QtCore/qobject.h:46:
In file included from C:/Qt/5.12.10/android_arm64_v8a/include\QtCore/qobjectdefs.h:48:
In file included from C:/Qt/5.12.10/android_arm64_v8a/include\QtCore/qnamespace.h:43:
In file included from C:/Qt/5.12.10/android_arm64_v8a/include\QtCore/qglobal.h:45:
In file included from D:\android\sdk\ndk\23.1.7779620/sources/cxx-stl/llvm-libc /include
\type_traits:416:
D:\android\sdk\ndk\23.1.7779620/sources/cxx-stl/llvm-libc /include\__config:218:12: fatal error:
'features.h' file not found
In my last try I dowloaded sdk and ndk using Android Studio. The versions of NDK that I have tried are 21, 22, 23 and 25
The JDK is jdk1.8.0_341.
All my Android 'Kits' in preferences->devices->Android have a warning about "No device set"
Edited:
Following the sugestions from Alexander Dyagilev worked. However I had issues with gradle and SDK. Then I have installed SDK 11 and gradle 7.0.2 and I advanced some steps further but yet I have erros.
My build.gradle is:
buildscript {
repositories {
maven { url "https://maven.google.com" }
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
}
}
allprojects {
repositories {
jcenter()
google()
mavenCentral()
}
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7: '
implementation 'com.google.android.gms:play-services: '
}
android {
/*******************************************************
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion androidBuildToolsVersion
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [qt5AndroidDir '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir '/res', 'res']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.comm5.visaocloud"
}
}
The build log is:
16:17:33: Running steps for project cloudclient...
16:17:33: Starting: "C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" clean -j16
del qrc_cloudclient_qmlcache.cpp
del qml_visaocloud_js.cpp qml_main_qml.cpp qml_content_LoginScreen_qml.cpp qml_content_ButtonControl_qml.cpp qml_content_SettingsScreen_qml.cpp qml_content_OeeIndice_qml.cpp qml_content_StackInformation_qml.cpp qml_content_MachineWidgetDelegateAutomatico_qml.cpp qml_content_DashboardScreen_qml.cpp qml_content_LineInformation_qml.cpp qml_content_FlipEffectImage_qml.cpp qml_content_MachineWidgetDelegateManual_qml.cpp qml_content_OeeMachineWidget_qml.cpp qml_content_DashboardUtils_js.cpp
del qmlcache_loader.cpp
del moc_predefs.h
del moc_dashboardlistmodel.cpp moc_notificationengine.cpp moc_hardwareutils.cpp moc_qjsonmodelarray.cpp
del main.moc
del main.obj dashboardlistmodel.obj deviceregistration.obj notificationengine.obj hardwareutils.obj JsonPath.obj qjsonmodelarray.obj deviceregistration_android.obj hardwareutils_android.obj qrc_cloudclient_qmlcache.obj qml_visaocloud_js.obj qml_main_qml.obj qml_content_LoginScreen_qml.obj qml_content_ButtonControl_qml.obj qml_content_SettingsScreen_qml.obj qml_content_OeeIndice_qml.obj qml_content_StackInformation_qml.obj qml_content_MachineWidgetDelegateAutomatico_qml.obj qml_content_DashboardScreen_qml.obj qml_content_LineInformation_qml.obj qml_content_FlipEffectImage_qml.obj qml_content_MachineWidgetDelegateManual_qml.obj qml_content_OeeMachineWidget_qml.obj qml_content_DashboardUtils_js.obj qmlcache_loader.obj moc_dashboardlistmodel.obj moc_notificationengine.obj moc_hardwareutils.obj moc_qjsonmodelarray.obj
del *~ core *.core
NÆo foi poss¡vel encontrar D:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\*~
16:17:35: The process "C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" exited normally.
16:17:35: Starting: "C:\Qt\5.12.10\android_armv7\bin\qmake.exe" D:\programming\comm5\visao\cloudclient\cloudclient.pro -spec android-clang "CONFIG =qtquickcompiler"
16:17:37: The process "C:\Qt\5.12.10\android_armv7\bin\qmake.exe" exited normally.
16:17:37: Starting: "C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" -f D:/programming/comm5/visao/b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease/Makefile qmake_all
make: Nothing to be done for 'qmake_all'.
16:17:38: The process "C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" exited normally.
16:17:38: Starting: "C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" -j16
C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147/toolchains/llvm/prebuilt/windows-x86_64/bin/clang -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 -fno-limit-debug-info -DANDROID_HAS_WSTRING --sysroot=C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147/sysroot -isystem C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147/sysroot/usr/include/arm-linux-androideabi -isystem C
.....
16:17:44: The process "C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" exited normally.
16:17:44: Removing directory D:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build/assets
16:17:44: Removing directory D:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build/libs
16:17:44: Starting: "C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" "INSTALL_ROOT=D:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build" install && cd D:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease && C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe "INSTALL_ROOT=D:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build" install
C:\Qt\5.12.10\android_armv7\bin\qmake.exe -install qinstall -exe ..\bin\deploy\libcloudclient.so D:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build\libs\armeabi-v7a\libcloudclient.so
C:\Qt\5.12.10\android_armv7\bin\qmake.exe -install qinstall -exe ..\bin\deploy\libcloudclient.so D:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build\libs\armeabi-v7a\libcloudclient.so
16:17:48: The process "C:\Users\Paoli\AppData\Local\Android\Sdk\ndk\21.3.6528147\prebuilt\windows-x86_64\bin\make.exe" exited normally.
16:17:48: Starting: "C:\Qt\5.12.10\android_armv7\bin\androiddeployqt.exe" --input D:/programming/comm5/visao/b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease/android-libcloudclient.so-deployment-settings.json --output D:/programming/comm5/visao/b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease/android-build --android-platform android-21 --jdk "C:/Program Files/Java/jdk-11.0.16" --gradle
Generating Android Package
Input file: D:/programming/comm5/visao/b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease/android-libcloudclient.so-deployment-settings.json
Output directory: D:/programming/comm5/visao/b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease/android-build/
Application binary: D:/programming/comm5/visao/bin/deploy/libcloudclient.so
Android build platform: android-21
Install to device: No
Warning: This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Warning: elemento inesperado (uri:"", local:"base-extension"). Os elementos esperados são <{}codename>,<{}layoutlib>,<{}api-level>
-- Skipping C:/Qt/5.12.10/android_armv7/plugins/iconengines/libqsvgicon.so. It has unmet dependencies: lib/libQt5Svg.so.
-- Skipping C:/Qt/5.12.10/android_armv7/plugins/imageformats/libqsvg.so. It has unmet dependencies: lib/libQt5Svg.so.
> Task :preBuild UP-TO-DATE
> Task :preDebugBuild UP-TO-DATE
> Task :compileDebugRenderscript
> Task :generateDebugBuildConfig
> Task :javaPreCompileDebug
> Task :checkDebugAarMetadata
> Task :generateDebugResValues
> Task :generateDebugResources
> Task :compileDebugAidl FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugAidl'.
> A failure occurred while executing com.android.build.gradle.tasks.AidlCompile$AidlCompileRunnable
> > Task :mergeDebugResources
com.android.ide.common.process.ProcessException: Error while executing process C:\Users\Paoli\AppData\Local\Android\Sdk\build-tools\33.0.0\aidl.exe with arguments {-pC:\Users\Paoli\AppData\Local\Android\Sdk\platforms\android-21\framework.aidl -oD:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build\build\generated\aidl_source_output_dir\debug\out -IC:\Qt\5.12.10\android_armv7\src\android\java\src -ID:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build\src -ID:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build\aidl -ID:\programming\comm5\visao\b-cloudclient-And_Qt_5_12_10_Clarmv7aRelease\android-build\src\debug\aidl -IC:\Users\Paoli\.gradle\caches\transforms-3\48a46c27b0d9b79f33541fa222ce4db4\transformed\support-media-compat-26.1.0\aidl -IC:\Users\Paoli\.gradle\caches\transforms-3\192ad8f6a0f651ff9f10305663e68198\transformed\support-compat-28.0.0\aidl -IC:\Users\Paoli\.gradle\caches\transforms-3\5d596afbbf514aaec8702eb472ca97f3\transformed\versionedparcelable-28.0.0\aidl -dC:\Users\Paoli\AppData\Local\Temp\aidl14331251136729576369.d C:\Qt\5.12.10\android_armv7\src\android\java\src\org\kde\necessitas\ministro\IMinistro.aidl}
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
7 actionable tasks: 7 executed
Warning: QML import could not be resolved in any of the import paths: br.com.comm5
Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils
Warning: QML import could not be resolved in any of the import paths: QtQuick.Extras.Private.CppUtils
Building the android package failed!
-- For more information, run this command with --verbose.
16:18:28: The process "C:\Qt\5.12.10\android_armv7\bin\androiddeployqt.exe" exited with code 14.
Error while building/deploying project cloudclient (kit: Android Qt 5.12.10 Clang armeabi-v7a)
The kit Android Qt 5.12.10 Clang armeabi-v7a has configuration issues which might be the root cause for this problem.
When executing step "Build Android APK"
16:18:28: Elapsed time: 00:56.
I hade also executed the command:
gradlew.bat --info build clean --stacktrace
The result is
Initialized native services in: C:\Users\Paoli\.gradle\native
Found daemon DaemonInfo{pid=25160, address=[c2b63990-e0d8-4817-ad20-5308929c843b port:53261, addresses:[/127.0.0.1]], state=Idle, lastBusy=1660756380138, context=DefaultDaemonContext[uid=badf4a2e-2eb1-4075-bba8-1291894fe5dd,javaHome=C:\Program Files\Java\jdk1.8.0_281,daemonRegistryDir=C:\Users\Paoli\.gradle\daemon,pid=25160,idleTimeout=10800000,priority=NORMAL,daemonOpts=-Xmx2048m,-Dfile.encoding=windows-1252,-Duser.country=BR,-Duser.language=pt,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files\Java\jdk-11.0.16,daemonRegistryDir=C:\Users\Paoli\.gradle\daemon,pid=77640,idleTimeout=null,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX: HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=windows-1252,-Duser.country=BR,-Duser.language=pt,-Duser.variant]
Actual: DefaultDaemonContext[uid=badf4a2e-2eb1-4075-bba8-1291894fe5dd,javaHome=C:\Program Files\Java\jdk1.8.0_281,daemonRegistryDir=C:\Users\Paoli\.gradle\daemon,pid=25160,idleTimeout=10800000,priority=NORMAL,daemonOpts=-Xmx2048m,-Dfile.encoding=windows-1252,-Duser.country=BR,-Duser.language=pt,-Duser.variant]
Looking for a different daemon...
Found daemon DaemonInfo{pid=42916, address=[f37e5b97-0c13-437c-9fa9-cb3379a13472 port:58153, addresses:[/127.0.0.1]], state=Idle, lastBusy=1660768619876, context=DefaultDaemonContext[uid=feb33525-5510-4ed1-b91a-1d728494e115,javaHome=C:\Program Files\Java\jdk-11.0.16,daemonRegistryDir=C:\Users\Paoli\.gradle\daemon,pid=42916,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048m,-Dfile.encoding=windows-1252,-Duser.country=BR,-Duser.language=pt,-Duser.variant]} however its context does not match the desired criteria.
At least one daemon option is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=C:\Program Files\Java\jdk-11.0.16,daemonRegistryDir=C:\Users\Paoli\.gradle\daemon,pid=77640,idleTimeout=null,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX: HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=windows-1252,-Duser.country=BR,-Duser.language=pt,-Duser.variant]
Actual: DefaultDaemonContext[uid=feb33525-5510-4ed1-b91a-1d728494e115,javaHome=C:\Program Files\Java\jdk-11.0.16,daemonRegistryDir=C:\Users\Paoli\.gradle\daemon,pid=42916,idleTimeout=10800000,priority=NORMAL,daemonOpts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens,java.base/java.nio.charset=ALL-UNNAMED,--add-opens,java.base/java.net=ALL-UNNAMED,--add-opens,java.base/java.util.concurrent.atomic=ALL-UNNAMED,-Xmx2048m,-Dfile.encoding=windows-1252,-Duser.country=BR,-Duser.language=pt,-Duser.variant]
Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 56268). The daemon log file: C:\Users\Paoli\.gradle\daemon\7.0.2\daemon-56268.out.log
Starting 15th build in daemon [uptime: 2 hrs 27 mins 22.878 secs, performance: 100%, non-heap usage: 30% of 256 MiB]
Using 16 worker leases.
Now considering [D:\programming\comm5\visao\cloudclient\native\android] as hierarchies to watch
Not watching anything anymore
Watching the file system is enabled if available
Starting Build
Settings evaluated using settings file 'D:\programming\comm5\visao\cloudclient\native\android\settings.gradle'.
Projects loaded. Root project using build file 'D:\programming\comm5\visao\cloudclient\native\android\build.gradle'.
Included projects: [root project 'android']
> Configure project :
Evaluating root project 'android' using build file 'D:\programming\comm5\visao\cloudclient\native\android\build.gradle'.
Invalidating in-memory cache of C:\Users\Paoli\.gradle\caches\journal-1\file-access.bin
Invalidating in-memory cache of C:\Users\Paoli\.gradle\caches\7.0.2\fileHashes\fileHashes.bin
Invalidating in-memory cache of C:\Users\Paoli\.gradle\caches\7.0.2\fileHashes\resourceHashesCache.bin
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
Not watching anything anymore
Watched directory hierarchies: []
And the error from this same command (2>gradle_error.txt)
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'D:\programming\comm5\visao\cloudclient\native\android\build.gradle' line: 44
* What went wrong:
A problem occurred evaluating root project 'android'.
> Could not get unknown property 'androidCompileSdkVersion' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'android'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:133)
at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:136)
....
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring root project 'android'.
> com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
* Try:
Run with --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'android'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:75)
My androidManifest.xml
<?xml version="1.0"?>
<manifest package="com.comm5.visaocloud" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.5.64" android:versionCode="12" android:installLocation="auto">
<application android:debuggable="false" android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Visao Cloud" android:icon="@drawable/icon" android:theme="@android:style/Theme.Holo">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="com.comm5.visaocloud.MainActivity" android:label="Visao Cloud" android:screenOrientation="unspecified" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<!-- Messages maps -->
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Messages maps -->
<!-- Splash screen -->
<!--
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
-->
<!-- Splash screen -->
<!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- Background running -->
</activity>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<!-- [START gcm_receiver] -->
<receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.comm5.visaocloud"/>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
</intent-filter>
</receiver>
<!-- [END gcm_receiver] -->
<!-- [START gcm_listener] -->
<service android:name="com.comm5.visaocloud.MyGcmListenerService">
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
</service>
<!-- [END gcm_listener] -->
<!-- [START instanceId_listener] -->
<service android:name="com.comm5.visaocloud.MyInstanceIDListenerService">
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
</service>
<!-- [END instanceId_listener] -->
<service android:name="com.comm5.visaocloud.RegistrationIntentService">
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
</service>
</application>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- %%INSERT_PERMISSIONS -->
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<permission android:name="com.comm5.visaocloud.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="com.comm5.visaocloud.permission.C2D_MESSAGE"/>
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21"/>
</manifest>
CodePudding user response:
This is caused by an unsupported version of NDK. You need to:
- Install the proper version of Android NDK in Android Studio (21.3.6528147) for Qt 5.12.
- Make sure it's selected by default in Qt Creator's settings. Here is my screenshot with the settings. Default NDK is written using italic font.
- An optional thing, probably it's required to specify
ANDROID_NDK_PLATFORM
environment variable also. You can change it in Qt Creator's settings, but I suggest to set it globally (in the system's env variables). Its value should beandroid-21
.
P.S. Do not forget to clean & rebuild project after all these changes.
CodePudding user response:
After a lot of changes I finaly was able to build the .apk file. I do not know among all the changes which was relevant and which not.
Some posts I have used are: Execution failed for task ':processDebugResources'. and a sugestions about how test gradle
About Sdk Version in build.gradle
My build.gradle is now
buildscript {
repositories {
maven { url "https://maven.google.com" }
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
}
}
allprojects {
repositories {
jcenter()
google()
mavenCentral()
}
}
apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7: '
implementation 'com.google.android.gms:play-services: '
}
android {
/*******************************************************
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion 28 // androidCompileSdkVersion.toInteger()
buildToolsVersion '26.0.2' // androidBuildToolsVersion
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [qt5AndroidDir '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir '/res', 'res']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.comm5.visaocloud"
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
}
}
I will study the Gradle documentation to avoid this annoying problema again. If someone has a suggestion about reading I will be grateful.