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.
export ANDROID_SDK_ROOT=/path/To/AndroidSdk
export ANDROID_NDK_ROOT=/path/To/AndroidNdk
export ANT_HOME=/path/To/Ant
export PATH=$PATH:$ANDROID_SDK_ROOT/tools:$ANT_HOME/bin:$JAVA_HOME/binqmake MyQtApp.pro -spec android-g++ CONFIG+=qtquickcompiler CONFIG+=$release
make
make install INSTALL_ROOT=/path/to/some/folder
$androiddeployqt --sign MyKey.keystore gevupc --storepass somePassword --output android --verbose --input android-libMyQtApp.so-deployment-settings.jsonThis 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:
https://github.com/benlau/qtci/blob/master/bin/build-android-gradle-projectMoreover, in case you build apk by command line. You may consider to use this script to increase the version code:
https://github.com/benlau/qtci#5-binincrease-android-version-code
-
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.
Required by:
:android-build:unspecified
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:
(DEV branch)
https://github.com/benlau/quickandroid/tree/DEV/examples/quickandroidexample