I'm trying to configure an headless build-server to build an Android NDK project that's using Cmake to build the C++ part.
Right now I'm having this issue:
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find CMake.
Install from Android Studio under File/Settings/Appearance & Behavior/System Settings/Android SDK/SDK Tools/CMake.
Expected CMake executable at /usr/local/android-sdk-linux/cmake/bin/cmake.
I've found a workaround!!
I've install cmake using this script: https://github.com/Commit451/android-cmake-installer
It's done the job until Google publish a fix so we can install it using the Sdk Manager (here link of the issue
Google has put a new tool into the SDK for this now (as of 25.2.3): sdkmanager
The SDK manager can be used from the command line: http://tools.android.com/recent/updatingsdkfromcommand-line
One thing to note though is that that's actually a rather old version of the SDK manager and it's fed from a different set of data, i.e. the packages available in the standalone SDK manager will not necessarily match those in the Studio SDK manager.
I'm running into the same issue myself. AFAIK, the only way you can install the Android CMake is through Android Studio since the command line tools don't include CMake when you run: android list sdk --all (version r24.4.1)
As a workaround, you can just package the SDK with CMake and download them to your server until CMake becomes available via the Android CLI tools.
Related
How to install Android NDK without SDK manager through ubuntu command line, there is no option i found to install through command line. I got this error during building gradle build in offline mode.
I struck in error org.gradle.api.InvalidUserDataException NDK is not configure. Download it with SDK manager. preferred NDK version is '21.4.7075529'
There is a command line SDK manager: https://developer.android.com/studio/command-line/sdkmanager
If you're using AGP you should let that manage the NDK. You're otherwise just doing exactly the same thing by hand. You would need to install the NDK to the correct location in the SDK, and doing it by hand is just an opportunity to make a mistake.
I had built an angular application and wanted to turn it into a native android app using cordova.
I had previously installed android-sdk using apt-get which was added to by /usr/lib folder. I also had installed Android Studio separately who's sdk-tools were located in ~/Android/Sdk.
Previously, my $ANDROID_HOME variable contained path /usr/lib but after installation of Android Studio I had changed it to <myhomedirectory>/Android/Sdk
Previously, the android-sdk tools installed had version 23, which was incompatible with the newer version of gradle, and gave me the following error upon running cordova run android (with sudo) in my project:
WARNING: The specified Android SDK Build Tools version (23.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.0.
Android SDK Build Tools 28.0.3 will be used.
Followed by the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;28.0.3 Android SDK Build-Tools 28.0.3
platforms;android-28 Android SDK Platform 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Using Android SDK: /usr/lib/android-sdk
The Android Studio I installed had tools installed for both API 28 and API 29, but I did not know why it was still giving me this error, until I noticed the last line of this error, which stated that my Android SDK is being fetched from /usr/lib (the old directory). I tried checking the environment variables again, sourcing the ~/.bashrc, as well as logging out but nothing really worked.
I decided to remove the previously installed android-sdk and purge the files using apt but even then nothing happened.
I even removed the mobile folder (the project folder for cordova I created) and even restarted from scratch, but it still gave me the same error.
I am unsure why it is still picking up the wrong path from environment variable, I've even echo-ed the variable and the path is the one I set just recently, but cordova for some reason seems to disagree.
There was an issue with the permissions in the cordova project. Had to sudo chown -R <myproject>. I first noticed when I tried sudo cordova requirements instead of cordova requirements (which said I had all requirements installed). I noticed these installations were on user level not on root level, which is why upon sudo it was giving me an error. After chown-ing simply run cordova run android. You'll no longer have issues.
When I tried to build QtFireExample with my QtCreator, failed with below error message.
The installed SDK tools version (26.1.1) does not include Gradle
scripts. The minimum Qt version required for Gradle build to work is
5.9.0/5.6.3 Error while building/deploying project QtFirebaseExample (kit: Android) When executing step "Build Android APK"
My android studio is 3.2.1. And SDK tools 26.1 is also installed.
qt version is also above 5.9.0
What I did mistake?
❯ qmake --version
QMake version 3.1
Using Qt version 5.12.0 in /usr/local/Cellar/qt/5.12.0/lib
There's more steps to follow before you can deploy your first Android app using QtCreator. Installing SDK tools is not enough. Here is what I did, I'm using Windows, but hopefully the steps are the same under Ubuntu.
Install QtCreator using the link provided by Hitokage, include QtCreator (I got version 4.8.0), and Qt 5.12.0 binaries for your platform + needed Android (armv7, x86...)
Get JDK 1.8.X.X
Get NDK r18b (or a more recent version)
Get SDK tools 26.1.1 (what you already did)
SDK tools itself is not enough, some SDK modules must be installed, from SDK tools folder, run:
sdkmanager platform-tools
sdkmanager build-tools;28.0.3
sdkmanager extras;google;usb_driver
sdkmanager platforms;android-22 (which is enough for me, you may want something different based on your target Android devices)
Then open QtCreator, Go to "Mobile devices" (my french version calls it "Appareils mobiles"), then make it point to installed JDK, SDK, NDK, clic Apply and then kits should be automtically created. Now you are ready to compile and deploy and Android app for API 22.
Note that gradle is automatically downloaded by QtCreator first time you'll request a deployment.
I have tried downgrading the SDK Tools which didn't work. What worked for me however was downloading the official QT installer (working on Linux), installed QT to a new directory along with ARM64-v8a and ARMv7 (which probably solved the problem, I didn't have that in the package I installed from Arch repo). Now I can (after allowing the developer and debug mode on the device) deploy the app on the phone.
EDIT: Then chose one of those auto-detected kits.
I am following an official NativeScript tutorial and having a problem configuring my OS X environment for android development.
When running tns platform add android I receive the following error:
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 21 or later.
The tns doctor command also returns warnings on android-sdk issues:
Cannot find a compatible Android SDK for compilation. To be able to
build for Android, install Android SDK 21 or later. Run $ android to
manage your Android SDK versions. You need to have the Android SDK
Build-tools installed on your system. You have to install version 22.
Run "android" from your command-line to install required Android Build
Tools. You need to have the latest Android Support Repository
installed on your system. Run $ android to manage the Android
Support Repository.
My android-sdk installation looks like this:
My .bash_profile also includes the followings:
export ANDROID_HOME="/usr/local/Cellar/android-sdk/24.3.4/"
export PATH="$PATH:~/npm-global/bin:/usr/local/Cellar/android-sdk/24.3.4/tools:/usr/local/Cellar/android-sdk/24.3.4/platform-tools"
Should I go further and try setting system-wide environment variables - not just for the .bash_profile? Also, it is possible that I missed something from the setup process...
Any tip on how I could debug this situation (commands, config files etc.) would be great, thank you!
Alright, so you need to make sure of following:
Make sure you have API 22 installed.
Make sure you you have Android SDK Build Tools 22.x.x installed. (Yes,
specifically 22.x.x)
Make sure you have Android support repository installed. (You can
find it under Extras section in Android SDK Manager)
Once you have performed steps mentioned above, run tns doctor again and you should see No issues were detected message.
This is because of sudo. The root user has no ANDROID_HOME set.
For Windows User:
Run 'android update sdk' from command line
Select Android 5.1.1(API22)
Select Tools folder
Select Extras and click on Install.
ps:- adding this answer, so that if any one land on this page can see it.
Check the ANDROID_HOME is ok
Install the API 22 + ion the Extras > Android Support Repository
Run the following
tns platform remove android
tns platform add android#next
Run
tns run android
then it should be OK
I solve this problem installing Android Support Repository from Extras.
updating SDK in AndroidStudio >> Preferenceswould help
on my windows 10 machine I had to open file explorer right click on this pc and go to properties on the left hand side I had to go to advanced settings. At the bottom I click environment variables then on the android_home variable I clicked edit then pointed it to this path on my machine where the sdk was installed
C:\Program Files (x86)\Android\android-sdk
This answer is on a Linux, not OSX, platform. However, since this is the SO that appears most often for the listed error, I'll share a recent fix that worked for me.
If you have done all of the above and are still getting the error, try this solution.
I am using NativeScript 8.0.2.
You will know that ANDROID_HOME and Java are configured correctly if you can run the command $ANDROID_HOME/tools/bin/sdkmanager --list. If that fails, then first check that your Java is compatible (I had to add OpenJDK 8 and change my PATH with export JAVA_HOME="/usr/lib64/jvm/java-1.8.0/")
In Android Studio, add a previous build tool version. Go to your SDK Manager > SDK Tools, tick the bottom box "Show package details", and add a previous version. In my case, 31.0.0 was the latest, and I added 30.0.3. Now run ns doctor android again and everything should pass.
Seems 31.0.0 is not yet properly recognised by Native Script.
I always got the error "✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later. "
I actually had to go to the android studio settings and install the exact SDK 28 before this error went away.
Android Settings Pic
This is an updated answer, I also had the same issue:
Like all the previous pictures above, I had to install the SDK platforms, using the SDK Manager. From the main screen of Android Studio, click More Actions and choose SDK Manager. Before that I had to add the platform-tools to my PATH in Windows
%LOCALAPPDATA%\Android\Sdk\platform-tools
That fixed my issue and the docs for setup are here.
I'm trying to use the Android Emulator on Jenkins to build and test my project. But I'm getting an the following error when running my gradle tasks;
failed to find Build Tools revision 17.0.0
the gradle task I'm running is;
./gradlew clean connectedCheck
in my gradle build file I has the following configuration
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 17
}
}
The build server is a headless Ubuntu instance (12 something). My first thought was that I didn't have the correct build tools installed so I had a look in my android-sdk/build-tools director. All I could see was a directory called 18.1.1. So I thought if I updated my android sdk it would download version 17.0.0. So I ran the following command:
android update sdk --no-ui
and it seems to download various many things but looking in the build tools directory again I still only see version 18.1.1.
So questions are:
1) Am I right in assuming the build is failing because I don't have the correct build tools revision in my android sdk directory? (/android-sdk/build-tools)
2) How do I update the build-tools on a headless server so that I have version 17.0.0?
If you need me to provide more information, please let me know.
Thanks in advance for you help.
By default, android update sdk (or android list sdk --extended) only lists the packages which aren't considered deprecated.
As Build Tools 17.0.0 is a comparatively old version, it won't be shown by default.
Running with the -a (--all) flag will get you the older versions, e.g.:
android update sdk -u -a -t build-tools-17.0.0
At some point in the future the Jenkins plugin should automatically install the correct build tools for you, based on your build.gradle file.
Edit (Nov 2015): This functionality probably will not be added to the Android Emulator plugin.
Nowadays I would recommend using the android-sdk-manager Gradle plugin, which automates the installation of all prerequisites for a Jenkins build, including Android SDK, tools, build-tools, platforms, support libraries etc.
This can be very easily integrated into your project, and removes the need to keep the Android SDK installation on your Jenkins build machines up-to-date.
Other way to do it, is manually update for the missing version using Android SDK Manager attached to Jenkins (Look for Configuration: ANDROID_SDK, then under it access "tools/android.sh")