I have a Qt app for android which I command line building it using a shell script. I want to use gradle. So I am using the following command for the install step.
androiddeployqt --sign mykey.keystore --storepass mypassword --output android-build --verbose --gradle --input MyApp/myapplib.so-deployment-settings.json
I had trouble using gradle 2.2.1. Hence, I updated my gradle wrapper by downloading gradle 3.1. But while running the command gradle still seems to be trying to download 2.2.1 and gives the following error.
Pregenerating entry list for assets file engine.
Downloading https://services.gradle.org/distributions/gradle-2.2.1-all.zip
Exception in thread "main" java.net.UnknownHostException: services.gradle.org
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Abs tractDelegateHttpsURLConnection.java:200)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1124)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:999)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1513)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:61)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Building the android package failed!
Can someone please point out how can I get rid of this error & build my Qt app using gradle ?
Set new variable "_JAVA_OPTIONS" in environment variables with following value
-Dhttp.proxyHost=192.168.0.1 -Dhttp.proxyPort=8080 -Dhttp.proxyUser=1234 -Dhttp.proxyPassword=5678 -Dhttps.proxyHost=192.168.0.1 -Dhttps.proxyPort=8080 -Dhttps.proxyUser=1234 -Dhttps.proxyPassword=5678
export _JAVA_OPTIONS="-Dhttp.proxyHost=192.168.0.1 -Dhttp.proxyPort=8080 -Dhttp.proxyUser=1234 -Dhttp.proxyPassword=5678 -Dhttps.proxyHost=192.168.0.1 -Dhttps.proxyPort=8080 -Dhttps.proxyUser=1234 -Dhttps.proxyPassword=5678"
1st: correct some invalid variables in QT's build settings/build environment (i.e. wrong slash was / instead of )... AND add some. Specifically:
ANDROID_HOME = D:\Android-SDK
ANDROID_SDK_ROOT = D:\Android-SDK
GRADLE_USER_HOME = C:\Users\pc\.gradle
JAVA_HOME = D:\Program Files\Java\jdk1.8.0_201
(obviously these need to be upd for your install directories .i.e usually on C: drive)
Note: I specified these in Windows env settings, but it seems like they need to be specifically set in QT's env overrides.
2nd: remove the 29.0.0RC1 from Android SDK build-tools via Android Studio SDK manager. Apply. Select 'show package details' to then be able to select the 28.0.3 version. Apply.
3rd: go into theQT project/app's folder and edit the gradle.properties file... change the line to:
androidBuildToolsVersion=28.0.3
Finally: you should probably should close and reopen QT and the project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With