Missing Gradle in Android SDK (using cordova + ionic) - android

Yep, i searched about this but nothing, just things about the ANDROID_HOME path, but in my case i don't think this is the real problem. When i try to do ionic build android i get this error:
Error: Could not find gradle wrapper within android sdk. Might need to update yo
ur Android SDK.
Looked here: C:\Android\sdk\tools\templates\gradle\wrapper
And found that in C:\Android\sdk\tools i dont have "templates" folder, just this:
I see gradle wrapper only in this path C:\Android\sdk\temp\ToolPackage.old01\templates\gradle\wrapper
Why i don't have Gradle in my sdk folder? i am missing something? in SDK manager i have this installed:
Thanks in advance

Had exactly the same problem. This thread points out the reason behind it, and this one actually shows what to do.
In short:
in Android Studio uninstall Android SDK Tools
Download tools_r25.2.3-yourOPsystem.zip from Android Downloads. Basicly same thing, older version.
insert downloaded extracted tools folder in Android/sdk/ folder
(MAC: /Users/username/Library/Android/sdk/tools
Win: C:\Users\username\AppData\Local\Android\sdk\tools)
In project folder run:
$ cordova platforms remove android
$ cordova platforms add android

On Linux android studio version-162.3871768-linux
copy paste
\Android Studio\plugins\android\lib\templates\
to Sdk/tools/

You need to update ANDROID_HOME variable to point the android-sdk folder
https://stackoverflow.com/a/32507036/344895

you have to upgrade your cordova library
cordova platform update android#6.2.1

I tested upgrade cordova to version 6.5 and extract tools SDK. Nothing helps.
In my case I have Android Studio installation.
SOLUTION: Please find file gradle-wrapper.jar in your Android Studio installation (in may case ..\Android Studio\plugins\android\lib\templates\gradle\wrapper\gradle\wrapper\ ). Then copy whole directory templates to SDK location in subfolder tools.

Set ANDROID_HOME to the SDK Path displayed in your Android SDK Manager. The default location is C:\Program Files (x86)\Android\android-sdk if you didn't change it.

go to https://developer.android.com/studio/index.html
cheak Download Option and download tools only
extact file and copy the templates folder
and paste in C:\Users(yourunername)\AppData\Local\Android\sdk\tools

update your sdk tools download tools_r25.2.3-yourOPsystem.zip.
[direct download link][1]
/Users/username/Library/android/sdk/tools

You cant find gradle in latest sdk. So try to install it manually. Follow this link
https://gradle.org/install

Related

How to fix 'Android SDK not found at this location' error while installing flutter?

I'm installing flutter in my Ubuntu 18.10. I'll be using Visual Studio Code for flutter development. I've not installed Android Studio.
I've downloaded Android Command line tools from official android site and extracted it in a separate folder in Documents/development/android
I set the path for ANDROID_HOME in the bashrc file by following the flutter documentation
Here is the .bashrc file
And the Android toolchain error
It seems that , you set the ANDROID_HOME variable but it is not added to PATH.
Make sure you add the ANDROID_HOME to the path as below
export PATH=$PATH:$ANDROID_HOME/bin
and re-launch the console.
update
In order for Android SDK to work fine, you need to set path for the below SDK packages.
..android-sdk\tools
..android-sdk\platform-tools
and your ANDROID_HOME will be
..android-sdk
I am not sure what you are referring to when you are saying that you have downloaded Android Command Line tools. From the output in your terminal, it tells me that you do not have the SDK files in your machine. To download the Android SDK, please see this link here and download the tar file that matches your operating system. Then extract the tar file in the folder which you have set as ANDROID_HOME. This should work fine.
In case you are having the same error, I strongly recommend downloading the Android Studio and install the Android SDK through the Android Studio. The flutter documentation says so as well. You can always uninstall or remove Android Studio after it is being installed and if you are not considering using it.
please replace yout android sdk in thatway this is default installation location of sdk C:\Users\Intel\AppData\Local\android\android_sdk

Cordova gradle wrapper missing in android sdk

I'm on windows7 x64, installed today's latest stable release of android sdk studio (through android studio bundle, since it's shipped together now apparently). I have properly configured the environment variables as you'll see above.
This is what I get when issuing the following command
$ cordova build android
ANDROID_HOME=G:\installs\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: G:\installs\Android\sdk\tools\templates\gradle\wrapper
And indeed, the "templates" directory doesn't even exist in my sdk install.
I've already tried the suggestions (setting the right path, uninstall/reinstall) of this question here but nothing applies to my case, and I find that manually copying and pasting packages is not really a solution, since there's a package manager in place.
If anybody has an answer as of today's android install, would be very much appreciated.
If still not working then copy all file from gradle\wrapper from Android Studio installation folder
C:\Program Files\Android\Android
Studio\plugins\android\lib\templates\gradle\wrapper
and paste it in your Android SDK gradle\wrapper then run same command.
E:\android-sdk\tools\templates\gradle\wrapper
This is a known issue; see CB-12544. For now you'll need to downgrade.
I downloaded Android SDK r25 manually and placed templates folder inside Android/sdk/tools. This solved the issue for me.
You can get it from https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip
For Windows:
https://developer.android.com/studio/index.html
Go to the section :"Get just the command line tools"
There is a link 'sdk-tools-darwin-3859397.zip' for Mac, Unfortunately that didn't have the templates folder with Gradle Wrapper. So for Mac users, i will suggest not to go for this zip.

cannot find zip-align when publishing app

cannot.find.zip.align=The zipalign tool was not found in the SDK.
Please update to the latest SDK and re-export your application
or run zipalign manually.
Aligning applications allows Android to use application resources
more efficiently.
This is the message I received when I tried to publish my app. I'm using the latest revision of Android SDK Tools (23 which was released today) and SDK Platform-tools (20 which was also released today). I got an APK out of it, but if I tried to upload it to Google Play I got an error complaining that it is not zip aligned.
Running zipalign manually fixes the apk, but does anyone know what causes this and how to fix it?
I had the same problem.
And to fix it, I copy the Zipalign file from sdk/build-tools/android-4.4W folder to sdk/tools/
Edited: Since Google updated SDK for Android, new build-tools does fix this problem. So I encouraged everyone to update to Android SDK Build-tools 20 as suggested by Pang in the post below.
I fixed it by installing Android SDK Build-tools 20:
In Eclipse → Pull Down Menu → Window → Android SDK Manager, check Android SDK Build-tools Rev. 20, then click the Install n package(s)… button to start installing.
It becomes usable if you install
Android SDK Build-tools Rev.20
I decided to just make a video for this..I kept pasting it into tools but alas that was not working for me. I moved it to platform-tools and voila publishing right away..must restart eclipse afterwards.
Tutorial for fixing missing zipalign
I used the full path of zipalign. For mac, I found the executable file in Finder and clicked on it. Then, to publish my app I ran
/Users/username/development/sdk/tools/zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk
instead of
zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk
Mac / Linux:
This worked for me (you might want to replace 22.0.1 with version of your build tools):
Edit: ~/.bashrc
export ANDROID_HOME=~/Android/Sdk/
export ANDROID_TOOLS=~/Android/Sdk/tools/
export ANDROID_BUILD_TOOLS=~/Android/Sdk/build-tools/22.0.1/
export ANDROID_PLATFORM_TOOLS=~/Android/Sdk/platform-tools/
PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:$ANDROID_BUILD_TOOLS
And run:
source ~/.bashrc
or just close terminal and start it again.
On a Mac, I did the following:
Find it on o/s (I had already downloaded build tools for 19 and 20)
Press Ctrl-Open to allow apps from the internet
Move it from sdk/build-tools/android-4.4W folder to sdk/tools/. Whew.
With the SDK update to 20, version 20 of the build and platform tools and 23 of the sdk tolls, Google has moved a lot of things.
Gradle (if you are using Android Studio) however has not yet been updated to reflect those changes, as stated in other Answers copying the zipalign binary to /sdk/tools/ should do the trick for now.
UPDATE: since Android Studio 0.8.1 got released the issue seems fixed now…
you only need to update your build.gradle and it should work fine again
compileSdkVersion 20
buildToolsVersion "20.0.0"
targetSdkVersion 20
and if you use any compat or support library
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.android.support:support-v4:20.+'
Check in the SDK manager, that it has installed the "build-tools". Mine in its default state, did not do this.
If you are using gradle just update ypur gradle plugin!
Change line in build.gradle from:
classpath 'com.android.tools.build:gradle:0.9.+'
to:
classpath 'com.android.tools.build:gradle:0.11.+'
It works for me.
Note that variable buildToolsVersion (for me "20.0.0") must match your version of build-tools.
Good luck :)
With Android Studio 1.0 you have to use zipAlignEnabled true
My fix worked copying zipalign.exe from sdk\build-tools\android-4.4W to sdk\platform-tools, as shown in video linked by digiboomz, and did not work copying it in sdk\tools
If zipalign command is not found from Command-Line add file path of zipalign to environmental variables. As mentioned above, it's never good to change exe file location.
For Windows users:
Add to User->PATH->"path to zipalign folder"
In my case it path was C:\adt-bundle-windows-x86_64-20140702\sdk\build-tools\android-4.4W.
In that folder is zipalign.exe
This link can help you with setting path and understanding it http://www.voidspace.org.uk/python/articles/command_line.shtml#path
I use Eclipse and this broke during an update. Here's what worked for me as the answers above did not.
I checked where ant's build.xml expected to find zipalign.exe.
In: C:\Development\Android\android-sdk\tools\ant\build.xml
zipalign is defined as:
<property name="zipalign" location="${android.build.tools.dir}/zipalign${exe}" />
which indicates its expected in:
C:\Development\Android\android-sdk\build-tools\18.0.1
This directory corresponds to the highest version of the 'Android SDK Build-tools' displayed as installed in the 'Android SDK Manager'. So, that's where I copied zipalign.exe (which I obtained from an Android Studio installation!) and signed apps are now automatically zipaligned again!
i solved by RUN as Administrator # your SDK Manager.exe in directory C:\Program Files\Android SDK
after that u'll get updated build tools an any repository
Steps to fix this,
Install latest version of Android SDK Build-Tools
Check if zipalign.exe is available in folder android-sdk\build-tools\ e.g. android-sdk\build-tools\21.1.0\
In some older version of android you may not find zipalign.exe. Do not panic, check any other verion in which zipalign is available.
Open your project.properties file and configure build-tools to point to the in which zipalign.exe is present. e.g. sdk.buildtools=21.1.0.
Restart your eclipse and try exporting again. It should work.
On a mac with OSX 10.10.5,Android Studio and SDK installed the path is
/Users/mles/Library/Android/sdk/build-tools/23.0.1/zipalign
Zipalign gradle task is deprecated since Android Plugin for Gradle, Revision 2.2.0 (September 2016).
If you want to keep using it, add android.useOldPackaging=true to your gradle.properties file.
Click here for detailed explanation.
Improves build performance by adopting a new default packaging pipeline which handles zipping, signing, and zipaligning in one task. You can revert to using the older packaging tools by adding android.useOldPackaging=true to your gradle.properties file. While using the new packaging tool, the zipalignDebug task is not available. However, you can create one yourself by calling the createZipAlignTask(String taskName, File inputFile, File outputFile) method.
APK signing now uses APK Signature Scheme v2 in addition to traditional JAR signing. All Android platforms accept the resulting APKs. Any modification to these APKs after signing invalidates their v2 signatures and prevents installation on a device.
Blockquote
zipalign was moved to build-tools\19.1.0 and build-tools\20.0.0, I assume you should use one of them in depend of your target SDK
I fixed it by uninstalling Android SDK Platform (4.4W) and then reinstalling it.
I also restarted Eclipse after the installation.
In my case SDK Build Tools 20 were already installed.
I copied zipalign.exe in Tools folder but without success.
After that I noticed that I updated Eclipse without removing or renaming the old folder.
So I did:
1) Renamed old Eclipse folder
2) Restarted Eclipse
Eclipse asked to correct Android preferences because problem was Eclipse, that was still trying to use the old folder
Google fix this mistake with the build tools version: 23.0.3
Now zipalign is packaged properly, and everything works fine.
Normally the zipalign.exe is close of the "Android manager"(also, "Android", "Android SDK" etc), so you can search for "Android Manager" in windows search and give a righ-click above the command and open file location.
You probably are in: something\ Android\android-sdk\tools. Then is just necessary return a folder and go to Android\android-sdk\build-tools\23.0.3.
The zipalign is there, you maybe be not able to use it with double-click, so you have to copy all the path of the zipalign file to use in CMD, the final code that you have to input will be something like:
C:\Users\heitor\AppData\Local\Android\android-sdk\build-tools\23.0.1\zipalign.exe -v 4 android.apk android2.apk
When I was completely desperate, I did the following, that allowed me to find official zipalign.exe. The short answer is to use the link from official (but not public :-) part of of the site:
https://dl.google.com/android/repository/build-tools_r28-rc1-windows.zip
If you use this recepy after 2018, you probably need the full explanation:
Open Android Studio and go
Android Studio->Tools->Android->SDK Manager->Android SDK->SDK update site
Write in text editor link and open it in the browser. In my case the first link worked for me:
https://dl.google.com/android/repository/repository2-1.xml
Look for the latest package build-tools. In my case, it was build-tools_r28-rc1-windows.zip, but you can find the latest in your time
Ctrl+F build-tools_
Substitute in the URL the last part with the found package name like I did:
https://dl.google.com/android/repository/build-tools_r28-rc1-windows.zip
Download the package, unzip it and fortunately find official file:
zipalign.exe
If it helps you, your feedback is wellcome.
I've fixed this issue by doing this:
Open Android Studio > Preferences > SDK Tools and check "Android SDK Build-Tools"

Failed to execute tools\android.bat: solution

When I try to open up the SDK Manager in eclipse it says opening shortly, but never opens. I've tried to open the exe file but it displays an error message saying:
Failed to execute tools\android:bat the system cannot find the file specified
My path environment variable leads it to the tools folder.
This is the path:
C:\Users\Shan\Documents\Computer Science - YEAR 2\Android App Development\adt-bundle-windows-x86-20130917\sdk\tools
In my case the Tools directory just disappear.
..\sdk\tools
To solve it:
1) Just go to SDK zip -> adt-bundle-windows-x86_64-20131030.zip
2) Unzip the Tools Directory only.
3) copy it under ../sdk/
I had a similar problem today. Press the Windows button and Search for android.bat(in the search programs and files text field)
Then copy the file to your android SDK folder (C:\Users\Shan\Documents\Computer Science - YEAR 2\Android App Development\adt-bundle-windows-x86-20130917\sdk\tools\).
After that don't run SDK manager but run the android.bat file.
Hope this helps
-Zaniar
I had to move the AVD manager from /sdk/tools/lib to the root folder /sdk
Copy the AVD Manager.exe and SDK Manager.exe from
SDK_ROOT_FOLDER/tools/lib/
into
SDK_ROOT_FOLDER
I've been working with this problem for three days and finally was able to run SDK Manager by
==> Running the android.bat file as administrator
Note: I did not have to make any changes to the .bat file (such as setting the java_exe path) in order for the manager to run.
I saw this as a comment on the top answer but can't upvote yet, so confirming it here!
I cancelled an update to Android Tools and it seems there's a bug with unzipping the old (or new?) version back into {android_sdk}/tools. The zip is located in {android_sdk}/temp. Just unzip it into the right location and it should work again.
If the accepted answer doesn't help anyone, it also might be a permission issue (if the SDK is installed in Program Files (x86), for example, so try running android.bat as Administrator,
I had the same issue when updating the Android SDK Tools and SDK Platform-tools from the SDK Manager. I had to replace the tools folder with one located in a zip folder inside the temp folder.
In My case, While I installed visual studio 2015, The SDK files were missed and I am getting an error window shown below.
So I manually downloaded the tools from the following URL.
tools_r24.0.2-windows
Then extract the zip file and copy the tools folder in the following location.
C:\Program Files (x86)\Android\android-sdk
It worked for me.
I think current Android SDK only works with JDK x86 version. I search so much but when installed JDK x86 version Android SDK manager worked without problem.
Copy your android.bat file to C:\adt-bundle-windows-x86_64-20140702\sdk\tools folder or copy all files to C:\.
If you are seeing this error, it may be an issue with your COMSPEC environment variable.
Please see https://stackoverflow.com/a/27284746/3866013 for more details.
I had the same problem. Caused it myself because while runing Android SDK Manager i hit UNINSTALL SDK Tools.
I fixed the issue by running the installation of the Android SDK again. The installation folder had to be the same as previously. After the installation, everything was back again as it was.
This is how I solved the problem on Windows 7:
I was going to update the SDK using Android SDK Manager but android.bat was not found because previously it uninstall the older one and then installs new. In my case my SDK Update was interrupted i.e. in other words, could not install after the SDK Manager uninstalled the tools, so my machine was not able to find android.bat. What I did was just downloaded the standalone SDK tools to the same folder where my SDK were from :
http://developer.android.com/sdk/index.html#Other
https://developer.android.com/sdk/index.html#Other
Here are two options for downloading the Android SDK for Windows users. One in recommended option and the other is .zip file. Zip file worked well.
Another option may also work. Try searching android.bat with windows search engine. If you find the one, copy it and paste in SDK tools folder.
open Sdk Manager.exe, then i deleted first Android Sdk tools, so, I also appeared such a mistake, then I downloaded installer_r24.3.2-windows.exe, installing, copy C:\Users\Super Man\AppData\Local\Android\android-sdk\tools folder to my Sdk path,run My Sdk Path\android.bat ,ok!!
I did the following :
I created a folder SDK right below my C-drive
I unzipped tools_r25.2.3-windows.zip to C:\SDK
I moved SDK Manager.exe from C:\SDK\tools\lib to C:\SDK
I first ran SDK Manager.exe in 'normal mode',but this gave me the error, but when I ran SDK Manager.exe as ADMINISTRATOR it didn't return the error.
The reg command exists but for unknown reason my path variable was corrupted during some installation.
So some basic element were missing:
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem

platform-tools\aapt.exe directory missing in android SDK

I'm trying to get 'hello world' working on the Android SDK with Eclipse. I'm following this tutorial step by step:
http://developer.android.com/resources/tutorials/hello-world.html
but i'm returned the error "Error executing aapt. Please check aapt is present at C:\android-sdk-windows\platform-tools\aapt.exe"
For some reason, the "platform-tools" folder does not exist under my installation. In its place I find "platforms" and "tools". Presumably, my SDK version is different to that used in the tutorial.
I can't work out what i need to change or update. Can someone please point me in the correct direction?
Thank you
Totally agree with izzy, but other times (usually on 64 bit OS machines or with multiple android platforms) when you install the latest SDK version the folder platform-tools had missing the "appt.exe".
To solve this you need to search on *android-sdk\build-tools* folder and subfolders like \build-tools\17.0.0 in my case, and you will find aapt.exe, other necesary files and lib folder, just copy it everything to android-sdk\platform-tools and it will be done.
sometimes you may get the error that it can not install because it can not create the temp folder to install the tools. You simply just need to run the SDK manager as administrator and this will allow it to all work out.
if we will face appt.exe issue (could not found) just Follow the below steps:
1. Just Read It(https://developer.android.com/studio/command-line/aapt2)
Navigate to (ctrl+find and search) com.android.tools.build > then go to aapt2 from this url (https://dl.google.com/dl/android/maven2/index.html)
Insert the version name you copied into the following URL and specify your
target operating system: https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/aapt2-version/aapt2-aapt2-version-[windows | linux | osx].jar
For example, to download version 3.2.0-alpha18-4804415 for Windows,
you would use: https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2/3.2.0-alpha18-4804415/aapt2-3.2.0-alpha18-4804415-windows.jar
Extract the jar file, Change the name aapt2.exe to apt.exe
Copy and paste into your android-sdk -> platform-tools
Run the program, Issue will be get resolved
Note: Means you have to download and set the aapt.exe path in System Environment Variable
*What version of the SDK are you running? (1.5_r2 or something?)*
I would suggest updating your SDK and be done with it ;)
You can do so trough the "Android SDK and AVD Manager".
Eclipse:
menu->window->"Android SDK and AVD Manager"
You might also want to change this setting:
menu->window->preferences->install/update->(expand)->automatic updates
Run the Android SDK Manager and be sure that you have checked and installed Tools>Android SDK Platform-tools.
I believe this package is responsible for the folder in question here.
I just found aapt.exe file in my latest Android-SDK folder (Android_SDK\build-tools\28.0.3)
You can check your latest sdk build-tools folder
or
You can search on total Android SDK folder by file name
I was able to delete my version (28.0.3) and Android Studio reinstalled it. The directory location was
C:\Users\YourUserName\AppData\Local\Android\Sdk\build-tools

Categories

Resources