Deploying to Android from QtCreator under mac osx
I am having trouble deploying an android app to device (or emulator), from mac osx.
Max osx 10.8, QtCreator 3.4.2, Qt 5.5, deploying to Nexus 7 running android 4.4.
As far as I am aware I have set up the environment suitably - SDK, NDK, ant, and java are all installed and referred to in Preferences->Android
./adb devices displays device OK.
The app builds ok, and an .apk file is created. I can transfer this apk to the device (e.g. via dropbox) and it installs and runs as expected.
But I cannot deploy and run it via QtCreator. When I attempt to run, I get the message "unable to start <appname>" in the Application Output window. The same is true of an auto-generated hello world app - builds ok, but I get 'unable to start "qt.org.example"'.
The green dot (over the android symbol at lower left) is visible on QtCreator, regardless of whether I have an android device connected.
On Linux I was able to get the same app running via QtCreator, but if I recall correctly (I do not have access to my linux system at the moment), after I pressed the green run arrow, a dialog opened giving me a choice of device to deploy to - I don't see this under mac osx, but I do see it when I select "Clean temporary libraries on device" from the Project->Run settings->Deploy configurations.
Is there something else I need to set up here? Something adb-related? Thanks.
Did you add the kit (in your case, the android device) in Qtcreator?
@Roshni Yes I have added an android kit. As I indicated, I am able to build an apk successfully.
Did you try with the "Use gradle instead of Ant" option ?
@SGaist Yes, tried gradle as well :)
What version of the Android SDK and NDK are you using ?
I am using r10e of the NDK, and 24.3.3 of the SDK. I just downloaded them last week, I believe they are the latest versions available.
Maybe a silly question but, do you have java installed properly ?
@SGaist Well it depends what you mean by properly ;)
In QtCreator I am referencing Java here:
That looks good…
Did you set the API level of your application to the same or a lower version corresponding to your device ?
@SGaist Yes I believe so. I've installed API 19 from the SDK manager, and I'm referring to API 19 under Projects->BuildAndroidAPK.
My device runs Android 4.4.4, which according to this:
uses API 19.
I've also just installed the latest and greatest Java JDK just incase anything was wrong there - 1.8.0_51 - and I've updated the path in the preferences accordingly. (The path by the way is a little different from that required for 1.6 - it's now in /Library/Java.... whereas before it was /System/Library/Java...)
But I wonder is the problem more the detection of the android device - the fact that it's always showing a green dot (even when my tablet is not connected) is strange. And under Preferences->Devices it tells me that the android device is "ready to use" even if there's no device there.
The problem is less pressing for me now as I'm back home and have access to my linux system, but it would still be nice to know what's going wrong on mac osx.
What do you get if you call
adb devices -l?
This is a demo video for deploying each different platform.
Check what the different with your operate.
And don't forget to rebuild your project.
Maybe you can connect with your android.
Just try it.
Sorry for the delay in replying to your suggestions. I am travelling again in the holiday season, and so I'm again trying to use my macbook to develop Android apps.
When I run ./adb devices -l, I see the device(s) OK - for example with my Nexus 7 tablet I see:
List of devices attached <some sort of device id> device usb:24100000 product:nakasi model:Nexus_7 device:grouper
Similarly if I have an emulator running, I see the emulator listed.
Regarding the video, thanks, but I don't see anything that I'm doing differently, except of course that I have more recent versions of Qt, Android SDK, android NDK, java etc than in the video. Interestingly in the video, you can see the author also sees "unable to start <appname> " (as I do) in the application output window, but the app starts for him.
A recent query here by a user targetting iOS had issues deploying apps with QtCreator 3.5 which were resolved by using QtCreator 3.6 - I have just updated to 3.6 but I experience the same problems as before.
Thanks for any suggestions.