Install the Android build tools version 19.1.0 - android

I run ionic run android and it starts to download lots of things except gradle that i downloaded it and set the path myself, now i have 2 question:
1: Should ionic framework always download lots of things with every new project?
and
2: How i resolve the below error , i set ANDROID_PATH variable to point Android-SDK where packages exist
What went wrong:
A problem occurred evaluating root project 'android':
No installed build tools found. Install the Android build tools version 19.1.0
or higher.

The answer is yes (through Gradle) and you have to set ANDROID_HOME and then add to PATH based on this.
On the Mac I had much the same problem. I was lacking the Android SDK. I don't know if that was your problem. I'll assume you don't have the SDK but you can pick up from your problem place in this list.
Download and install Android SDK for you platform. I'm on Mac so will present instructions from that perspective.
Go to Configuration on login splash screen or Preferences through File or Apple menu.
Go to Appearance and Behaviour > System Settings > Android SDK
Observe the Android SDK Location. Mine is /Users/me/Library/Android/sdk
Open ~/.profile
Add export ANDROID_HOME=/Users/me/Library/Android/sdk
Add export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Save and source ~/.profile
You could have the additional problem of not having Gradle installed. Try:
Download the binary
Extract to /usr/local or wherever you can write (eg. ~/lib where I install such things locally) if you don't have admin rights
sym link the version of gradle - cd /usr/local;ln -s gradle-3.5 gradle
Add /usr/local/gradle to your $PATH like above and source ~/.profile again.
I reread the question and realised I had added too much detail in my answer. I believe the $ANDROID_HOME and path line is what you are missing.
You may also need to open Android Studio and do whatever configuration it requires. And setup a SDK Platform also in that configuration window discussed above.
I hope that helps.

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.

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.

React Native Install Error

I am consistently running into the same error when I run "react-native run-android." Here is the error:
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 23.0.1
I tried this --> failed to find Build Tools revision 21.1.1 - sdk up to date --> and got the same error.
I installed the android sdk with homebrew and my ANDROID_HOME export is in my .bash_profile and .zshrc file as:
export ANDROID_HOME=/usr/local/opt/android-sdk
When I go to this directory and look in the "build-tools" directory I do see 23.0.1.
Does anyone have any advice?
EDITS:
I'm also unable to run "react-native run-android" with any flags. I'm not seeing any output from stacktrace, info or debug.
Finally figured it out! Chris Geirman's answer is also valuable, so I would start there as I did. One thing to mention is that I installed React Native with Homebrew. If Chris's method does not work look into the following:
Go to your React Native project directory that is created by react-native init
Open the android directory.
Open the file local.propertiesIf you don't have this file you can make one.
Make sure the sdk.dir value is pointing to the correct directory. In my case the path need to be sdk.dir = /usr/local/opt/android-sdk
As an extra bit of reassurance I also located that directory above to make sure that the build tools version that was missing (23.0.1) was in that directory.
EDIT:
I found that this is a post install error. If you run react-native init and you don't have $ANDROID_HOME set, you will run into this error.
I found this in the book Learning React Native and thought you might find this quote helpful.
If you receive a warning about a missing package, run android and check to see if
that package is listed as “installed”. If not, install it. If it is installed, but React Native
can’t find it, follow the steps above to try and fix any issues with your development
environment. You should also check to make sure that your ANDROID_HOME environ‐
ment variable is properly set and points to your installation of the Android SDK. For
example, on my system:
$ echo $ANDROID_HOME
/usr/local/opt/android-sdk

I can't get IntelliJ to recognise my Android SDK

I am trying to make Android programs using IntelliJ. Unfortunately, I cannot get the Android SDK to be recognised on IntelliJ. (I.e. Eclipse has Android SDK Manager installed just fine.)
I select create new project from scratch.
I give the project a name and select make Android module.
Create source directory (next).
The computer then shows Android SDK none. I click the ellipses (...) and the program can see my JDK files.
I click on the + and select Android SDK.
I then find the directory c:\Program Files (x86)\Android\android-sdk.
However, when I click OK a dialog box appears stating "Please select Java SDK". It only gives me the choice of 1.6 (and not the other one 1.7). I then press OK for 1.6.
Finally the computer then reports it cannot find any Android targets in this SDK.
Please help!!!!
Before creating a new Android Project on IntelliJ Idea, you need to configure the Java and Android Development Kits at the IDE level.
Assuming you already installed the JDK and the Android SDK and you just launched IntelliJ (I'm using version 13.0.2):
Press Ctrl+Shift+Alt+S (to access the Project Structure dialog)
On the left navigation pane, click on 'Project Settings->Project'
On the right navigation pane, you should see a drop-down list displaying '<No SDK>'
Click on 'New', select 'JDK' and choose the path to your JDK
Click on 'New', select 'Android SDK' and choose the path to your Android SDK
Please note you have to define the JDK before the Android SDK.
This procedure is documented at:
https://www.jetbrains.com/idea/webhelp/configuring-global-project-and-module-sdks.html
On linux, run tools/android under the SDK to run the Android SDK Manager. Then download one or more of the platforms. Check out "SDK Readme.txt" in the SDK directory for more. Once you're done there, you will be able to select a platform, and your IntelliJ system will start to run.
For others who may encounter this issue on Intellij14 + Mac - the solution that worked for me was to
1) Open intellij - select add android sdk from the project settings section, select the android-sdk-macrox root directory
2) the sdk manager pops up - download at least 1 package.
3) Restart intellij (without this restart, it didnt seem to work)
Oddly, IntelliJ 12 Community doesn't give us the option to select the JDK location for Android projects.
I've found a workaround for this:
First, create a new Java project. I used 'Java Hello World' project. This'll give you the chance to select your JDK.
Install the Android SDK and run the Android SDK Manager to install tools and a platform, as others have mentioned.
Create a new Android project. Under 'SDK', select the Android SDK. Intellij will remember the JDK location you defined in step #1.
On Mac, IntelliJ won't detect the installation of Android SDK. When selecting SDK for new Android module, select your android-sdk-macosx folder as your location.
More info: https://peterboctor.wordpress.com/2010/12/02/installing-the-android-sdk-on-mac-os-x/
Alternatively, Google just releases Android Studio which is a whole IDE base on IntelliJ.
With IntelliJ IDEA 14.1.2, I couldn't select the Android SDK install location on Mac OS X. That install location was ~/Library/Android/sdk, which IntelliJ wouldn't navigate to because ~/Library is a hidden folder. So I created a symlink in my home directory (ln -s ~/Library/Android/sdk/ ~/AndroidSDK) and IntelliJ DID let me select that.
(linux, osx)
When going standalone (without Android Studio), make sure you have the sdk tools (from the standalone sdk, "command line tools" option), build-tools, platform-tools and an sdk (platform).
./tools/bin/sdkmanager --update
# list available packages (pick a version)
./tools/bin/sdkmanager --list
# install requeriments
./tools/bin/sdkmanager "build-tools;26.0.0"
./tools/bin/sdkmanager "platforms;android-26"
# you might get wrong permissions from the downloaded packages
sudo chmod -R +rxw tools # will need write perm to create AVDs
This may help others. I found that I couldn't get IntelliJ (MacOS) to recognise the Android targets in the android-sdk-macosx folder. Moving the Android SDK folder out of the Applications folder and into a directory in my User's folder resolved the issue. IntelliJ was then able to recognise the Android SDK. It may have had something to do with permissions, but no errors were shown to indicate this. Hope this helps.
I had the same problem with version 15 intelliJ after upgrading on OS Linux Ubuntu 12.04
I found because the android sdk wasn't in the home folder of the user running intelliJ that you had to change the Folder/file permissions before it would see this
Mine was in the root
Issuing the command chown -R <yourusername> /path/to/android_sdk_dir
solved the problem for me
If this fails after doing this delete the ~/.ideaC(Lastversion number) any previous ~/.ideaC(Lastversion numbers) folder's and then re open intelliJ
You will have to go through the initialization of the IDE and give the path to your Java installation ver8 upwards only on intelliJ version15 and thereafter your android sdk installation
I found this can also cause conflicts
As a further tip add the following to the very end of your ~/.bashrc using one of your editors my (nano , vi etc )
Example vi ~/.bashrc
The following lines set the Android Path
PATH=$PATH:/path/to/android/:/path/to/android/tools
export PATH
For SDK version r_08 and higher, also add these two lines for adb:
PATH=$PATH:/path/to/android/platform-tools
export PATH
for setting android emulator to 32 bit version add this line
export ANDROID_EMULATOR_FORCE_32BIT=true
Exit your choice of editor (vi , nano etc ) and
Re invoke bashrc with the command below
source ~/.bashrc
Hope that helps you
You need to run SDK Manager.exe to download at least one of the platforms, then you'll be able to select the downloaded platform, see also this tutorial.
If you are behind a proxy server :
1.After starting the Android-SDK-Manager, go to :
Tools > Options.
Add your proxy details.
2.Then go to Packages > Reload
3.After this you should be able to see all the platform options of the Android.
PS : Pheew! Spent an hour figuring this out!
You can create symlink to your sdk location, even to hidden folder. And then point point IDEA to symlink.
For example: ln -s /Users/*username*/Library/Android/sdk /Users/*username*/androidsdk

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