Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to switch from ant to gradle while qmake building command line or in a shell script
I use following in a shell script for building android apk from my Qt app. Following is the crux of it.
qmake MyQtApp.pro -spec android-g++ CONFIG+=qtquickcompiler CONFIG+=$release
make install INSTALL_ROOT=/path/to/some/folder
$androiddeployqt --sign MyKey.keystore gevupc --storepass somePassword --output android --verbose --input android-libMyQtApp.so-deployment-settings.json
This is of course using ant. How can I switch qmake to use gradle instead of ant ? WIth gradle I want to support auto-incremental versioning of the app
@Nelson_Piquet You need to add "--gradle" to the androiddeployqt.
An example is available at:
Moreover, in case you build apk by command line. You may consider to use this script to increase the version code:
@benlau thanks a lot. i will try that
This post is deleted!
@benlau Sorry to come back to this after a gap. I dont see a build.gradle file in your project. Is that not required ? adding --gradle kicks in gradle but it gives the follwoing error. Isnt there a sample qt project building with gradle that I can see ? there must be so many
Getting following error with gradle :
A problem occurred configuring root project 'android-build'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:1.1.0.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.1.0/gradle-1.1.0.pom'.
jcenter.bintray.com: unknown error
@Nelson_Piquet My link is an example script to show how to build androiddeployqt with gradle.
androiddeployqt --input $JSON --output `pwd`/android-build --deployment bundled --android-platform android-18 --gradle --no-gdbserver $DEPLOY_ARGS
I don't know how to solve your problem but you may try this example project: