Analog Clock example; Build & Run on Android
I'm trying to get the Analog clock example running on my Android phone (I am developing on a Windows 7 box).
I'm currently getting a Build failure inside QT Creator (version 4.8.0 ):
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'android-build'. > Could not resolve all files for configuration ':classpath'. > Could not download protobuf-java.jar (com.google.protobuf:protobuf-java:2.5.0) > Could not get resource 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar'. > Could not GET 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0.jar'. > Connect to d29vzk4ow07wi7.cloudfront.net:80 [d29vzk4ow07wi7.cloudfront.net/220.127.116.11, d29vzk4ow07wi7.cloudfront.net/18.104.22.168, d29vzk4ow07wi7.cloudfront.net/22.214.171.124, d29vzk4ow07wi7.cloudfront.net/126.96.36.199] failed: Connection timed out: connect
To get this far, I've done the following (the important stuff that I can remember):
- Install Java 1.8.0 (Android development doesn't seem to work with other versions in Qt creator)
- Install Android Studio & downloaded the SDKs, NDK, USB Driver
- Download & Install Samsung Android USB drivers ('SAMSUNG_USB_Driver_for_Mobile_Phones.zip')
- Update the 'gradle.properties' file (which was auto-generated for the Qt project) to include my proxy settings.
I don't have any trouble downloading the protobuf jar file when I paste the URL into my web browser and the Android build seems to have downloaded other files successfully (once I added the proxy info in the 'gradle.properties' file).
Also, I can successfully deploy and debug Android apps (to my phone) using Android Studio on the same PC.
Anyone know how to get past this current build failure above?
I'm no longer getting this error when I build.
In the "Build Settings" > "Android_DeviceKit" > Build Steps I checked the 'Generate seperate debug info' checkbox and re-built. The error then went away. Then I un-checked the same checkbox, cleaned & re-built; and the error didn't come back.
It doesn't make any sense to me why it started working when I did that, but I'm just thankful that I can move on to fixing the next thing that doesn't work.
Next thing to figure out is why debugging isn't working when I try to 'debug' from Qt Creator. I can see that the apk is successfully created in a 'android-build\build\outputs\apk' directory. And I can successfully install it onto my phone and run it on my phone manually.
But, I had expected that I could click the 'Debug' button from Qt Creator, select my phone from the Android device selector and that Qt Creator would deploy the apk, start the application and attach the debugger to it (you know, the way Visual Studio and Android Studio work).
But when I try this, the build is successful, but in the 'Application Output' text output I'm seeing the following:
Cannot find/copy C++ debug server. "org.qtproject.example.analogclock" died.
Wish me luck.
There is a Bug filed called "Can't debug Android App":
In one of the comments someone mentions that you'll need to manually update the AndroidManifest.xml file to add the attribute
To the Application tag.
This gets the Application deployed and starts it up. But looks like the debugger still can't attach.
And it also looks like the Manifest gets autogenerated and needs to be updated each time you try to debug. Hopefully there is something one can set to adjust the automatic generation so you don't have to edit that manifest each time you need to deploy.