Qt: No android kits found - android

The kit was there untill I updated Qt due to certain problem.
In option > android I have set everything up, such as the SDK, NDK, Ant and JDK.
Below NDK it says it has found 6 toolchains.
In the kits section it only auto-detected one, which is the desktop...

I ran into this same problem - it was because I hadn't installed the QT compilers for Android.
To fix it, you need to go back to the installer (may need to uninstall the current version or install in a new directory) and expand the QT version you're using then check the relevant Android packages to be installed. Once the install is complete, set the SDK, NDK, JDK, and Ant and it should show the new kits in the build and run page.

You have not selected any Qt version. You should select something like Qt 5.3 (Android_ARMV7) for that field.
You can also Goto Tools > Option > Android settings page and make sure Automatically create kits for Android tool chains is checked, and apply it. If you check this option, it will create the kit with an appropriate name.
Now, goto Tools > Option > Build and Run settings page, and click on Kits tab and check if Qt Creator created the Android kits.

Related

Cordova fails to find ANDROID_HOME environment variable

I looked all over Google and Stack Overflow for an answer, but I couldn't find the right one for me. I am learning Cordova and I'm trying to run the android emulator through terminal, and when I run 'sudo cordova emulate android' I get this message:
''Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Detected 'avdmanager' command at /Users/username/Library/Android/sdk/cmdline-tools/latest/bin but no 'tools/bin' directory found near.
Try reinstall Android SDK or update your PATH to include valid path to SDK/tools/bin directory.''
But I set the variables in the ~./bash_profile file and it looks like this:
export ANDROID_HOME="/Users/username/Library/Android/sdk"
export ANDROID_SDK_ROOT=$ANDROID_HOME
export PATH=${PATH}:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
export PATH=${PATH}:$ANDROID_HOME/tools/bin
export PATH="$PATH:$ANDROID_HOME/build-tools/30.0.0-rc2"
I am using a MacOS Mojave, does anyone know what the issue is?
Thanks in advance
Apparently, in the latest version of Android Studio, the old SDK tools (under /tools, which Cordova seems to expect) are already considered obsolete. There is a solution documented here on how to install the old version of SDK tools.
Open Android Studio
Open Tools -> Sdk Manager
Click on the Sdk Tools Tab
Uncheck Hide Obsolete Packages
Check Android Sdk Tools (Obsolete)
Click Apply
This should download the old SDK tools under the correct folder.
However, I think Cordova also needs to keep up with the newest Android development tools. There's another change I needed to make after this:
I had to delete the tools/emulator and tools/emulator-check binaries, and add $ANDROID_HOME/emulator to my $PATH, since the current emulator binary lives under emulator/emulator instead of path/emulator. See this post.
Then I was finally able to launch the app directly via Cordova.

Install Android SDK without Studio on Linux for Qt Creator

Android Studio does not start on my machine with a warning about unsufficient memory. So I want to work on Android apps with Qt Creator. Unfortunately Google decided to make it harder to just get the Android SDK and refers to Android Studio, so all older tutorials link to dead pages or to pages that are redirected to the Android Studio website.
So what are the steps needed to install the plain SDK, the NDK and enable Qt Creator for Android development?
I documented the steps I took to make it work and will post them in an answer hoping they will be halpful for other people as well.
This is how it works in February 2017.
Download the Android SDK command line tools from the link at the bottom end of https://developer.android.com/studio/index.html
Unzip. Note that you need to leave the folder name untouched (tools/), otherwise it will not work. I have it unpacked as /usr/local/Android/android-sdk/tools creating the folders Android/ and android-sdk/ and then unzip into android-sdk/.
Run ./android from the tools/ folder. A GUI is spawning where you can select SDK stuff to be installed. Of course there is also a newer version of the SDK tools available than the one you just downloaded two minutes ago. ;)
Select the Android version of your device (you can probably deselect the Intel-based sub packages and Android TV stuff from that version, so check the contents of the packages you select. If in doubt, install them, though. :) ... The installation process will take some time.
Download the Android NDK from https://developer.android.com/ndk/downloads/index.html
Unzip. According to my SDK tools folder, I chose to unzip the NDK into /usr/local/Android/ as android-ndk/.
In Qt Creator go to the Settings dialog (Tools -> Settings...) and there to Devices -> Android and fill in the locations of your SDK and NDK. Note: for the SDK you need to state the folder containing the tools/ folder, not the tools/ folder itself. So for me:
/usr/local/Android/android-sdk
/usr/local/Android/android-ndk
Add some SDK and NDK paths to your shell's rc file, e.g. ~/.bashrc or ~/.zshrc:
export PATH=$PATH:/usr/local/Android/android-sdk/tools
export PATH=$PATH:/usr/local/Android/android-sdk/platform-tools
export PATH=$PATH:/usr/local/Android/android-ndk
Now you should be good to go. ... For me on one system the QtCreator kits were created automatically on another they weren't. Not sure why. If needed, you can create the kits manually and be done. :)

Unable to build Android APK in Qt Creator

I am trying to build an android APK in Qt Creator 3.0.1 . I have properly given the configured Android SDK, NDK, Ant, Java Jdk. In Build Android APK step under Build there is a option to specify Android Build SDK i.e target SDK. I am currenty using API 21 but it i am not getting an option to specify it over there.
Plz Help how can i do that.
First you should select Tools > Options > Android to add paths to the Android NDK and SDK :
Also select the Automatically create kits for Android tool chains option.
For configuring deployment settings you should go to Projects > Build Android APK > Details Since Qt 5.4 along with QtCreator 3.3.0. To create an APK package, select the Bundle Qt libraries in APK option :
You can also select Create Templates to create the manifest file to set application settings like icon, name, ...
In previous versions of Qt and Qt Creator you should go to Projects->Run->Deploy.
I recommend you to use the latest version of Qt and Qt Creator for Android development and deployment.
What helped me - switch off antivirus. Why see below:
I've got the same error and reinstallation didn`t help.
Runnning manually 'android.bat list targets' from cmd gives proper list of targets.
After digging into QtCreator code I found the reason - magic code for get list of targets in qt:
void AndroidConfig::updateAvailableSdkPlatforms() const
{
QProcess proc;
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
proc.start(androidToolPath().toString(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
if (!proc.waitForFinished(10000)) {
proc.terminate();
return;
}
As you can see if 'android.bat list target' cmd will not finish for 10 seconds qtcreator will just terminate the process.
In my case it was 15 secs befor it finishes due to antivirus checks - so switching off antivirus could help in your case.
No need to restart QtCreator just open Android section in options again and all targets should be loaded.
I 'love' Qt - it is always like this with it.

Eclipse missing C/C++ build and general from project properties

I have eclipse running and am trying to get opencv4android on it (http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html)
Instructions say to go to project -> properties and their will be a C/C++ build to change the location of ndk-build. However, I do not see C/C++ build or general.
When I start eclipse and go to about:
Android Developer Tools
Build: v22.0.1-685705
This product includes Eclipse Platform, JDT, CDT, EMF, GEF and WTP,
all of which are Copyright (c) Eclipse contributors and others.
Visit http://eclipse.org/
Android Developer Tools are Copyright (c) The Android Open Source Project.
Visit http://developer.android.com
I had a similar problem, it looks like the "native support" part was not set up correctly in the project, or at least was not compatible with the eclipse / CDT / android sdk combination I have.
You can maybe try what I did (with eclipse 4.2.2, CDT 8.1.2, opencv4android 2.6.4, android sdk 4.3):
1) close all projects but the Opencv Library one (project explorer, select all projects but the first one, right click, "close project")
2) right click on the first project. Select "Android Tools", then "Add native support ...".
3) select a unique library name without spaces (default names don't work).
4) Go to project properties, the "c/c++ build" section should now be there. Change the build command to ${NDKROOT}/ndk-build, assuming NDKROOT was correctly set up before-hand.
5) right click again on that project. Select "Properties > Android", make sure an Android version is selected in the "Project Build Target" list.
6) build everything and make sure everything works at this point.
Then you can re-open one sample project (eg 15 puzzle), and repeat the operations above if needed.
Hopefully you should be able to build that sample project and launch it on your phone.
It looks like NDK setting become a global setting not a project setting (plug in improvement) and instruction from opencv.org is outdated.
To setup it select: Window/Preferences then Android/NDK and choose "NDK location".
From now following instruction from opencv.org should make it work (If not try steps 1-3 from #dcoz answer, I did it but I'm not sure it if is necessary).
I've had a similar problem on debian testing after an upgrade.
Reinstalling eclipse / cdt did not help.
I've had to rm -r "$HOME/.eclipse" to get it working again.

The "Run As -> Android Application" is no longer an option in my Eclipse Run Configuration

I'm running Eclipse 3.7.2 on a Win7 machine. I have the Android SDK and AVD. All was working well. I have an Android App project that I've run under the emulator on an AVD and on a real Android device. ADB worked fine as well.
At some point I grabbed SDK Android 4.0.3. Then I had to upgrade a few more things that I cannot remember, perhaps my AVD. But ever since this upgrade there is no option to run my package as an Android Application anymore. If I choose "Run" it throws up a menu asking me to select a way to run it and "Android Application" is not a choice. It has to be Java App, etc. If I open "Run Configurations" there is no "Android Application" in my left column.
My SDK manager still lists Android 4.0 and Android 4.0.3 as "Installed." My AVD Manager still let's me launch an Android virtual device and even create a new one. But Eclipse does not let me run my package as an Android Application.
Make sure you check for updates to the Android ADT plug-in for Eclipse in addition to upgrades for the AVDs, SDKs, and other debug tools. Then make sure you're in your Android perspective (upper left of Eclipse window), rather than some other/generic Java perspective (no Android-specific options).
Also, you can check under Window > Customize Perspective... in Eclipse to double-check that all the Android options (menus, context items, views, toolbars) you want are enabled.
UPDATE:
You can add the Android tools to any perspective (I named mine "Android"). From the DDMS or Java perspective, go to Window > Customize Perspective - DDMS. Click the Command Groups Availability tab, and make sure that "Launch" is checked.
Also go to Project > Properties > Run/Debug Settings and check that there is a Launch Configuration listed. Create/Edit that configuration and confirm that it has an Android tab (usually set to run the Default Activity from your Manifest).
If not, there may be something wrong with your project's association - try right-clicking on your Project in Project Explorer, go to Android tools (if available) > Fix Project Properties. I believe there's an Ant tool that can do this from the command-line, but you'd have to check the Android/Google docs.
There's also the possibility that something's off with your Eclipse installation or that you've got a newer ADT plug-in than your version of Eclipse. Eclipse Juno (v4.2) released at the end of June, and the most recent ADT plug-in may be looking for something that's not there in your v3.7 install.
What fixed it for me was:
Right-clicking on the Project Name in the Package Explorer
Android Tools -> Fix Project Properties
After that I was able to just Click Run As -> Android Application and all was well for me
Click mouse right button on your project -> Configure -> Convert ADT Android Configuration
An easy fix is to manually create an android run configuration:
Run / Run configurations..., then right click on "Android application" and select new, select your project and click Run.
I had a similar problem. What I finally did that worked was go into Project->Properties->Java Build Path->Order and Export and I made sure that the /gen files we're first in the sequence followed by the /src files.

Categories

Resources