I am developing Android application using Ionic framework (Ionic is built on top of Apache Cordova). When I try to build my app, I get an error, which states that build tools are missing.
Error:
> No installed build tools found. Install the Android build tools version 19.1.0 or higher.
I am using windows, and I have Android SDK tools installed (at C:\tools), also I have used sdkmanager to install platform-tools (at C:\platform-tools) and android26 and android27 platforms (at C:\platforms\android-26 and C:\platforms\android-27).
My ANDROID_HOME enviroment variable is set to C:\tools and I have included all of the following locations in my path:
C:\tools
C:\tools\bin
C:\platform-tools
C:\platforms
I believe I am missing something, what do I have to do/fix for my build to succeedd. What are those build tools that I do not have installed?
You have set "ANDROID_HOME" to your sdk tools folder. This is causing an error in the relative navigation used by Cordova.
Solution: Create a new folder "SDK" in your C drive as such C:\SDK. Now add all of the sdk stuff into that directory. Finally, change your "ANDROID_HOME" path to C:\SDK
Related
I am trying to build a Xamarin Forms 3.4 solution but am getting the following compilation error:
Unable to access jarfile C:\Program Files (x86)\Android\android-sdk\build-tools\32.0.0\\lib\dx.jar
The folder in question only contains the following files:
apksigner.jar
d8.jar
shrinkedAndroid.jar
I opened the Android SDK Manager and can't see any installed platforms or tools. I get the error:
Loading SDK component information failed. Please retry.
This solution built just fine last time I worked on it. I'm thinking of re-installing Xamarin but that feels a little dramatic.
Here is what you can do: -
Open the Android SDK Manager with another version of Visual Studio (2022).
Go to Tools Tab > Android SDK Build Tools and uninstall the 32.0.0 version.
This will allow your project to pick another version with the dx.jar file. Install version 30.0.2 if you don't have it already.
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.
I am trying to build and generate an apk for my Ionic 4 application. When I attempt to do this, I am met with the following error:
A problem occurred evaluating project ':CordovaLib'.
[cordova] > No installed build tools found. Install the Android build tools version 19.1.0 or higher.
I have looked at many other solutions on Stackoverflow for this problem and nothing has fixed my issue. I have the Android SDK and SDK tools installed through the Android Studio SDK manager.
I have ANDROID_HOME set in both my .bash-profile and Android Studio path variables. Here is what my .bash-profile file looks like, which is where I believe environmental variables are intended to be set?
export ANDROID_HOME=~/Users/zacharyjordan/Library/Android/sdk
export ANDROID_SDK_ROOT=~/Users/zacharyjordan/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
When I attempt to build my application, it doesn't even seem as if Ionic is detecting my updated ANDROID_HOME path. It lists ANDROID_HOME as ANDROID_HOME=/usr/local/Caskroom/android-sdk/4333796
If anyone knows what I can do to get my app to build properly I would greatly appreciate it. No other solutions on Stackoverflow have fixed my problem thus far.
I just troubleshooted this error on a coworker's computer and the problem was an environment variable called ANDROID_SDK_HOME that was set to a different folder (C:\Android in his case). Changing that variable to match the actual sdk folder fixed the issue.
First of all you get that because of your environment path is not correct.
What worked for me (Windows 10):
open Android Studio -> SDK Manager -> SDK Tools
☐ Hide Obsolete Packages
☑ Show Package Details
From Android SDK Build-Tools list
☑ 29.0.3
Set the PATH for the ANDROID_HOME to YOUR_PATH\sdk
I have the Android SDK and SDK tools installed through the Android
Studio SDK manager
SDK tools is different than the build tools.
Go to SDK manager, download build tools v19.1.0 or higher then error should be gone.
I managed to resolve my issue with the above error by creating 2 environment variables on my OSX machine for ANDROID_HOME this essentially is the same as what you did above but for my paths. (I had not done this prior.)
After that I ran the command sdkmanager "platform-tools" in my cordova projects CLI. I had difficulties resolving this issue before using Android Studios SDK Manager but this method seemed to clear things up.
Note: If build tools cannot be found for your project. It's worth trying sdkmanager "build-tools" in your CLI.
Hope this helps.
I fixed it by
export ANDROID_HOME=~/Android/Sdk
This question already has answers here:
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK - Android
(24 answers)
Closed 5 years ago.
I am trying to take build in an ionic2 application. I got this error while running ionic build android. The error log is
ANDROID_HOME=/home/varun/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /home/varun/Android/Sdk/tools/templates/gradle/wrapper
I tried updating the sdk but it was found that the sdk version is latest.
When i looked at the Android/Sdk/tools folder there is no templates directory. I am running on ubuntu 16.04, with cordova version 6.5.0
Edit:
There has been a newer release of Cordova Android that also fixes some problems with SDK tools 26.x.x
cordova platform update android#6.2.2
or
cordova platform rm android
cordova platform add android#6.2.2
Old answer
Google broke Cordova Android 6.1.x and some other frameworks with their latest sdk tools update.
Cordova Android 6.2.1 has been released and it's now compatible with latest Android SDK.
You can update your current incompatible android platform with cordova platform update android#6.2.1
Or you can remove the existing platform and add the new one (will delete any manual change you did inside yourProject/platforms/android/ folder)
cordova platform rm android
cordova platform add android#6.2.1
You have to specify the version because current CLI installs 6.1.x by default.
I resolved by this by replacing the tools folder in my Android SDK with an older version of the SDK tools (r25.2.3). Follow these steps to do the same:
Navigate to https://developer.android.com/studio/index.html, click "Download Options", scroll down, and download the command line tools package for your platform, ensuring that you get a version in the r25.2.X series (not r25.3.X).
Unzip this folder. You should end up with a tools directory.
Navigate to your $ANDROID_HOME directory (~/Library/Android/sdk/ on OS X).
Rename the pre-existing tools directory there to tools.bak (e.g., mv tools tools.bak)
Move the tools directory you just downloaded into the SDK folder (e.g., mv ~/Downloads/tools/ .)
A new major version of the SDK tools was just released, which appears to be causing some issues with Ionic (see the press release here: http://tools.android.com/recent/androidsdktoolsrevision2530feb2017).
This worked for me
cordova platform update android#6.1.2
There's no need to downgrade Android Tools.
On Windows gradle moved from:
C:\Users\you_username\AppData\Local\Android\sdk\tools
to:
C:\Program Files\Android\Android Studio\plugins\android\lib\templates\gradle\wrapper
So you just need to ajust your path so that it points to the right folder.
I had same problem and I solved it with Carlos Delgado's answer.
Android Path must be set before all things below.
Download the latest command line tools (https://developer.android.com/studio/index.html -> very bottom part)
Unzip -> copy and paste "tools > templates" folder to your project folder (/Libraries/Android/sdk/tools/)
press option key to see Libraries folder in your Finder
I'm using cordova 3.3.0 on Windows in cygwin, and I'm getting the following error when I try to add the android platform
Error: An error occured during creation of android sub-project.
C:\Users\Mike\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
throw e;
^
Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.
I have the latest available versions or java, ant and the android sdk api 19 installed, as well as the latest android tools, platform-tools and build-tools but the error persists. (I tried to post an image of my SDK Manager to show this but I don't have enough reputation :(
The end of my PATH variable contains the correct locations for android tools and platform-tools as suggested here
....:/cygdrive/c/Users/Mike/bin:/cygdrive/c/Tools/apache-ant-1.9.3/bin:/cygdrive/c/Tools/sdk/platform-tools:/cygdrive/c/Tools/sdk/tools:/cygdrive/c/Program Files/Java/jdk1.7.0_51/jre/bin
The strange thing is that my project used to build correctly, but then stopped working when nothing noticeable had changed. I've fixed this before by building a new cordova project, but now I get this error with a brand new HelloWorld cordova project:
Mike#Mike-VAIO /cygdrive/c/workspaces/apps
$ cordova create test com.example.test HelloWorld
Creating a new cordova project with name "HelloWorld" and id "com.example.test" at location "C:\workspaces\apps\test"
Mike#Mike-VAIO /cygdrive/c/workspaces/apps
$ cd test
Mike#Mike-VAIO /cygdrive/c/workspaces/apps/test
$ cordova platform add android
Creating android project...
Error: An error occured during creation of android sub-project.
C:\Users\Mike\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
throw e;
^
Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.
I've tried reinstalling cordova but that doesn't help. Does anyone have any other ideas?
many thanks in advance
You should check if Target 19 really exists. Go to your android SDK folder, then to platforms and check if there is a folder called android-19.
But still this looks like cordova is not able to point out your android SDK folder or your target 19 folder.