How to install android SDK tools without installing Android studio on ubuntu? - android

I was trying to install Android SDK with the help of the SDK command line tools downloaded from the link https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip on my Linux Ubuntu 16.04 PC.
i run the command following command for installation
./android update sdk
sudo ./android update sdk
but getting the this
error
how to solve this error ?or suggest me a proper way to install build tools.
FYI
and also i read that ~/.android should contain androidtool.cfg file which has below data in it.
http.proxyPort=proper_port
http.proxyHost=Proper_proxy_ip
sdkman.show.update.only=true
sdkman.ask.adb.restart=false
sdkman.force.http=true

It says that android script is deprecated, so you must use $ANDROID_HOME/tools/bin/sdkmanager --update for update all the installed packages, and $ANDROID_HOME/tools/bin/sdkmanager --list for see a list of installed, updates and available packages.
See more options at: https://developer.android.com/studio/command-line/sdkmanager.html or with $ANDROID_HOME/tools/bin/sdkmanager --help
$ANDROID_HOME refer to the location of your Android SDK. by example:
export ANDROID_HOME=$HOME/android/sdk

Related

Install Android NDK on Jenkins

I wanted to install the Android NDK on my Jenkins. What I normally do to install components is execute the command
android list sdk --all
and
android update sdk -u -a -t <package number>
Unfortunately android list sdk --all is not showing the NDK, CMake and LLDB sdks that I need.
Why those sdks are not showing on the sdks list?
How can I install the NDK on my Jenkins?
Thanks for the help
Instead of using the command line, you can simply download the NDK per your machine and unzip it to a directory wherever you like. NDK can be downloaded at: https://developer.android.com/ndk/downloads. All the components, e.g. NDK, CMake and LLDB are shipped inside.
Update: If you really want to go for command line approach, command sdkmanager (under directory: <your-path>/sdk/tools/bin) is the way to go.
E.g. List installed and available packages
./sdkmanager --list
To install NDK directly use below.
./sdkmanager "ndk-bundle"
./sdkmanager "lldb;3.1"
./sdkmanager "cmake;3.6.4111459"

how to install android sdk tools (release 25.2.5) on ubuntu 16.04?

I was trying to install SDK tools (tools_r25.2.5-linux) downloaded from follwing link https://dl.google.com/android/repository/tools_r25.2.5-linux.zip on my Linux Ubuntu 16.04.
I run both the following command for installation
./android update sdk
sudo ./android update sdk
but the installation is stopping and giving this error
also ~./android/androidtool.cfg (both /root/.android and /home/user/.android directory) file contains following data
http.proxyPort=proper_port
http.proxyHost=proper_proxy
sdkman.show.update.only=true
sdkman.ask.adb.restart=false
sdkman.force.http=true
what issue is causing the problem? how can i solve this?

You have not accepted the license agreements of the following SDK components [duplicate]

This question already has answers here:
Automatically accept all SDK licences
(63 answers)
Closed 5 years ago.
I downloaded the latest Android SDK tools version 24.4.1. I used the command line to install SDKs. I typed y when asked
Do you accept the license 'android-sdk-license-c81a61d9' [y/n]: y
after that install succeeded.
But when using Gradle 3.1 to build, the follows shows up
You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 23, Android SDK Build-Tools 23.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
I checked ~/.android and /opt/android-sdk where Android tools are put. Neither contain folder named licenses.
The way to accept license agreements from the command line has changed. You can use the SDK manager which is located at: $ANDROID_SDK_ROOT/tools/bin
e.g on linux:
cd ~/Library/Android/sdk/tools/bin/
Run the sdkmanager as follows:
./sdkmanager --licenses
e.g on Windows:
cd /d "%ANDROID_SDK_ROOT%/tools/bin"
Run the sdkmanager as follows:
sdkmanager --licenses
And accept the licenses you did not accept yet (but need to).
For more details see the Android Studio documentation, although the current documentation is missing any description on the --licenses option.
Warning
You might have two Android SDKs on your machine. Make sure to check both ~/Library/Android/sdk and /usr/local/share/android-sdk! If unsure, fully uninstall Android Studio from your machine and start with a clean slate.
Update: ANDROID_HOME is deprecated, ANDROID_SDK_ROOT is now the correct variable
You can install and accept the license of the SDK & tools via 2 ways:
1. Open the Android SDK Manager GUI via command line
Open the Android SDK manager via the command line using:
# Android SDK Tools 25.2.3 and lower - Open the Android SDK GUI via the command line
cd ~/Library/Android/sdk/tools && ./android
# 'Android SDK Tools' 25.2.3 and higher - `sdkmanager` is located in android_sdk/tools/bin/.
cd ~/Library/Android/sdk/tools/bin && ./sdkmanager
View more details on the new sdkmanager.
Select and install the required tools. (your location may be different)
2. Install and accept android license via command line:
Update the packages via command line, you'll be presented with the terms and conditions which you'll need to accept.
- Install or update to the latest version
This will install the latest platform-tools at the time you run it.
# Android SDK Tools 25.2.3 and lower. Install the latest `platform-tools` for android-25
android update sdk --no-ui --all --filter platform-tools,android-25,extra-android-m2repository
# Android SDK Tools 25.2.3 and higher
sdkmanager --update
- Install a specific version (25.0.1, 24.0.1, 23.0.1)
You can also install a specific version like so:
# Build Tools 23.0.1, 24.0.1, 25.0.1
android update sdk --no-ui --all --filter build-tools-25.0.1,android-25,extra-android-m2repository
android update sdk --no-ui --all --filter build-tools-24.0.1,android-24,extra-android-m2repository
android update sdk --no-ui --all --filter build-tools-23.0.1,android-23,extra-android-m2repository
# Alter the versions as required ↑ ↑
# -u --no-ui : Updates from command-line (does not display the GUI)
# -a --all : Includes all packages (such as obsolete and non-dependent ones.)
# -t --filter : A filter that limits the update to the specified types of
# packages in the form of a comma-separated list of
# [platform, system-image, tool, platform-tool, doc, sample,
# source]. This also accepts the identifiers returned by
# 'list sdk --extended'.
# List version and description of other available SDKs and tools
android list sdk --extended
sdkmanager --list
Go to your $ANDROID_HOME/tools/bin
and fire the cmd
./sdkmanager --licenses
Accept All licenses listed there.
After this just go to the licenses folder in sdk and check that it's having these five files:
android-sdk-license, android-googletv-license, android-sdk-preview-license, google-gdk-license, mips-android-sysimage-license
Give a retry and build again, still jenkins giving 'licenses not accepted' then you have to give full permission to your 'sdk' directory and all it's parent directories. Here is the command:
sudo chmod -R 777 /opt/
If you having sdk in /opt/ directory.
I have resolved the problem by using the command:
Go to: C:\Users\ [PC NAME] \AppData\Local\Android\sdk\tools\bin\ (If the folder is not available then download the Android SDK first, or
you can install it from the android studio installation process.)
Shift+Left click and Press W, then Enter to open CMD on the folder path
Type in the cmd: sdkmanager --licenses
Once press enter, you need to accept all the licenses by pressing y
Checking the licenses
Go to: C:\Users\ [PC NAME] \AppData\Local\Android\sdk\
Check the folder named licenses
android-googletv-license
android-sdk-license
android-sdk-preview-license
google-gdk-license
intel-android-extra-license
mips-android-sysimage-license
AS NEW UPDATE FOLDER PATH (Current Android Studio)
Open Android Studio, Tools > Sdk Manager > Android SDK Command-Line Tools (Just Opt-in)
SDKManager will be store in :
Go to C:\Users\ [PC NAME] \AppData\Local\Android\Sdk\cmdline-tools\latest\bin
Type in the cmd: sdkmanager --licenses
Documentation to using the Android SDK: https://developer.android.com/studio/command-line/sdkmanager.html
For Windows users w/o using Andoid Studio:
Go to the location of your sdkmanager.bat file. Per default it is at Android\sdk\tools\bin inside the %LOCALAPPDATA% folder.
Open a terminal window there by typing cmd into the title bar
Type
sdkmanager.bat --licenses
Accept all licenses with 'y'
Update for macOS Sierra 10.12.6 - Android Studio for Mac 2.3.3
Locate the sdkmanager file usually under:
/Users/YOUR_MAC_USER/Library/Android/sdk/tools/bin
./sdkmanager --licenses
Warning: File /Users/mtro.josevaler**strong text**io/.android/repositories.cfg could not be loaded.
6 of 6 SDK package licenses not accepted.
Review licenses that have not been accepted (y/N)? Y
To validate the problem has gone just repeat the operation involved in the license issue.
I solved the problem by opening the Android SDK Manager and installing the SDK build tools for the version it is complaining about (API 24).
I had also updated using the command line previously and I suspect the Android SDK Manager has a more complete way of resolving dependencies, including the license.
Maybe I'm late, but this helped me accept SDK licenses for OSX,
If you have android SDK tools installed, run the following command
~/Library/Android/sdk/tools/bin/sdkmanager --licenses
Accept all licenses by pressing y
Voila! You have accepted SDK licenses and are good to go..
If you want to use the IDE to accept the license, I also found it easy to open up Android Studio and create a new basic project to trigger the license agreements. Once I created a project, the following licensing dialog was presented that I needed to agree to:
I documented fully the information in the following post: Accepting the Android SDK License via Android Studio
I had a similiar problem but ./sdkmanager --licenses didnt work. I follow this thread and "obladors" comment gave me the solution:
https://github.com/oblador/react-native-vector-icons/issues/527
What eventually solved my problem was:
Running ./sdkmanager "build-tools;23.0.1"
Change 23.0.1 with your version
You can accept the license agreement by launching Android Studio, then going to:
Help > Check for Updates...
When you are installing updates, it'll ask you to accept the license agreement. Accept the license agreement and install the updates, and you are all set.
I ran across this error when i ran cordova build android
I solved this issue by firing ./sdkmanager --licenses and accepting all the licenses.
You have a sdkmanager.bat under the android sdk folder in the path: android/sdk/tools/bin
To trigger that open a command prompt in android/sdk/tools/bin
type ./sdkmanager --licenses and enter
Press y to review all licenses and then press y to accept all licenses
In linux
1. Open a terminal
2. Write: "cd $ANDROID_HOME/tools/bin (this path can be /home/your-user/Android/Sdk/tools/bin)"
3. Write: "./sdkmanager --licenses"
4. To accept All licenses listed, write: "y"
5. Ready!
If your are building an app with Ionic Framework, just write again the command to build it.
If you are having this problem for a React Native app, in addition to above mentioned steps, make sure you have the local.properties file in the android directory(AppName/android) of your app which points to your 'sdk' directory:
sdk.dir=/PATH_TO_SDK/
I have resolved the issue by below steps:
update the android sdk with command "tools/android update sdk --no-ui"
got to android sdk folder on jenkins machines, create "licenses" folder
created file named "android-sdk-license" and paste the license from dev machine

How to install Android SDK on Ubuntu?

For my Ubuntu machine, I downloaded the latest version of Android SDK from this page.
After extracting the downloaded .tgz file, I was trying to search for installation instructions and found:
To get started on Linux:
Unpack the .zip file you've downloaded. The SDK files are download separately to a user-specified directory.
Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later when using the SDK tools from the command line.
What exactly are we supposed to do?
Option 1:
sudo apt update && sudo apt install android-sdk
The location of Android SDK on Linux can be any of the following:
/home/AccountName/Android/Sdk
/usr/lib/android-sdk
/Library/Android/sdk/
/Users/[USER]/Library/Android/sdk
Option 2:
Download the Android Studio.
Extract downloaded .zip file.
The extracted folder name will read somewhat like android-studio
To keep navigation easy, move this folder to Home directory.
After moving, copy the moved folder by right clicking it. This action will place folder's location to clipboard.
Use Ctrl Alt T to open a terminal
Go to this folder's directory using cd /home/(USER NAME)/android-studio/bin/
Type this command to make studio.sh executable: chmod +x studio.sh
Type ./studio.sh
A pop up will be shown asking for installation settings. In my particular case, it is a fresh install so I'll go with selecting I do not have a previous version of Studio or I do not want to import my settings.
If you choose to import settings anyway, you may need to close any old project which is opened in order to get a working Android SDK.
From now onwards, setup wizard will guide you.
Android Studio can work with both Open JDK and Oracle's JDK (recommended). Incase, Open JDK is installed the wizard will recommend installing Oracle Java JDK because some UI and performance issues are reported while using OpenJDK.
The downside with Oracle's JDK is that it won't update with the rest of your system like OpenJDK will.
The wizard may also prompt about the input problems with IDEA .
Select install type
Verify installation settings
An emulator can also be configured as needed.
The wizard will start downloading the necessary SDK tools
The wizard may also show an error about Linux 32 Bit Libraries, which can be solved by using the below command:
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1
After this, all the required components will be downloaded and installed automatically.
After everything is upto the mark, just click finish
To make a Desktop icon, go to 'Configure' and then click 'Create Desktop Entry'
source
To install it on a Debian based system simply do
# Install latest JDK
sudo apt install default-jdk
# get latest sdk tools - link will change. go to https://developer.android.com/studio/#downloads and look for "Command line tools only" download from webpage as you will need to accept terms. Then extract.
mkdir cmdline-tools
mv <folder-you-extracted> android-sdk/cmdline-tools
# So after this step is done you will have ~/cmdline-tools/tools with bin/ and lib/ in it.
Then add the Android SDK to your PATH, open ~/.bashrc in editor and add the following lines into the file
# Export the Android SDK path
export ANDROID_HOME=$HOME/cmdline-tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Run
source ~/.bashrc
Show all available sdk packages
sdkmanager --list
Identify latest android platform (here it's 33) and run
sdkmanager "platform-tools" "platforms;android-33"
Now you have adb, fastboot and the latest sdk tools installed
Android SDK Manager
sudo snap install androidsdk
Usage
You can use the sdkmanager to perform the following tasks.
List installed and available packages
androidsdk --list [options]
Install packages
androidsdk packages [options]
The packages argument is an SDK-style path as shown with the --list command, wrapped in quotes (for example, "build-tools;29.0.0" or "platforms;android-28"). You can pass multiple package paths, separated with a space, but they must each be wrapped in their own set of quotes.
For example, here's how to install the latest platform tools (which includes adb and fastboot) and the SDK tools for API level 28:
androidsdk "platform-tools" "platforms;android-28"
Alternatively, you can pass a text file that specifies all packages:
androidsdk --package_file=package_file [options]
The package_file argument is the location of a text file in which each line is an SDK-style path of a package to install (without quotes).
To uninstall, simply add the --uninstall flag:
androidsdk --uninstall packages [options]
androidsdk --uninstall --package_file=package_file [options]
Update all installed packages
androidsdk --update [options]
Note
androidsdk it is snap wraper of sdkmanager
all options of sdkmanager work with androidsdk
Location of installed android sdk files : /home/user/AndroidSDK
See all sdkmanager options in google documentation
UPDATE: This method is no longer recommended and installation is as easy as downloading it from the official website, then running the downloaded binary.
ORIGINAL ANSWER:
There is no need to download any binaries or files or follow difficult installation instructions.
All you really needed to do is:
sudo apt update && sudo apt install android-sdk
Update: Ubuntu 18.04 only
I can tell you the steps for installing purely via command line from scratch.
I tested it on Ubuntu on 22 Feb 2021.
create sdk folder
export ANDROID_SDK_ROOT=/usr/lib/android-sdk
sudo mkdir -p $ANDROID_SDK_ROOT
install openjdk
sudo apt-get install openjdk-8-jdk
download android sdk
Go to https://developer.android.com/studio/index.html
Then down to Command line tools only
Click on Linux link, accept the agreement and instead of downloading right click and copy link address
cd $ANDROID_SDK_ROOT
sudo wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
sudo unzip commandlinetools-linux-6858069_latest.zip
move folders
Rename the unpacked directory from cmdline-tools to tools,
and place it under $ANDROID_SDK_ROOT/cmdline-tools,
so now it should look like: $ANDROID_SDK_ROOT/cmdline-tools/tools.
And inside it, you should have: NOTICE.txt bin lib source.properties.
set path
PATH=$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin
This had no effect for me, hence the next step
browse to sdkmanager
cd $ANDROID_SDK_ROOT/cmdline-tools/tools/bin
accept licenses
yes | sudo sdkmanager --licenses
create build
Finally, run this inside your project
chmod 777 gradlew
sudo ./gradlew assembleDebug
This creates an APK named -debug.apk at //build/outputs/apk/debug
The file is already signed with the debug key and aligned with zipalign,
so you can immediately install it on a device.
REFERENCES
https://gist.github.com/guipmourao/3e7edc951b043f6de30ca15a5cc2be40
Android Command line tools sdkmanager always shows: Warning: Could not create settings
"Failed to install the following Android SDK packages as some licences have not been accepted" error
https://developer.android.com/studio/build/building-cmdline#sign_cmdline
If you are on Ubuntu 17.04 (Zesty), and you literally just need the SDK (no Android Studio), you can install it like on Debian:
sudo apt install android-sdk android-sdk-platform-23
export ANDROID_HOME=/usr/lib/android-sdk
In build.gradle, change compileSdkVersion to 23 and buildToolsVersion to 24.0.0
run gradle build
install the android SDK for me was not the problem, having the right JRE and JDK was the problem.
To solve this install the JVM 8 (the last fully compatible, for now):
sudo apt-get install openjdk-8-jre
Next use update-alternative to switch to the jre-8 version:
sudo update-alternatives --config java
You can revert JVM version when you want with the same update-alternatives command
Note that you problably have to do the same after this with javac also (now you have only java command at version 8)
first do:
sudo apt-get install openjdk-8-jdk
next:
sudo update-alternatives --config javac
After this you can install android SDK that require this specific Java version
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer oracle-java7-set-default
wget https://dl.google.com/dl/android/studio/ide-zips/2.2.0.12/android-studio-ide-145.3276617-linux.zip
unzip android-studio-ide-145.3276617-linux.zip
cd android-studio/bin
./studio.sh
Install Android Studio with
sudo snap install android-studio --classic
when you open it for the first time it will install the SDK for you (with options) .

Can i build Linphone in Android Studio on Mac?

I think we can build it. But I am getting error to build it on Android Studio. First I download the Android Studio and NDK. Then add the PATH of Android Studio and NDK to the PATH Variable. When I run
./check_tools.sh
I get the output
Could not find automake. Please install it.
Could not find autoconf. Please install it.
Could not find pkg-config. Please install it.
Could not find ant. Please install it.
Could not find yasm. Please install it.
Could not find wget. Please install it.
Could not find libtoolize. Please install libtool.
Invalid version of nasm: your version does not support elf32 output format. If you have installed nasm, please check that your PATH env variable is set correctly.
Failed to detect required tools, aborting.
But i doubt whether i need these tool on Android Studio or not. When I run the project i get the error
java.lang.UnsatisfiedLinkError: Couldn't load linphone-armeabi-v7a: findLibrary returned null.
Can anybody tell me the solution for that.
Yes you can do this
follow the step by step guide at this blog
How to build culinphone on Android Studio using Mac OS X?
http://culinphone.wordpress.com
Here is a step to step guide.
Setup Linphone Sdk on Mac OS X
How to build Linphone in Android Studio on Mac?
Step by step guide :-
Required Knowledge :-
Android Tools
Android Studio
A little bit about mac-terminal(shell)
S/W Requirements:-
Mac OS-X with these tools (You definetely need these tools to build linphone) :-
coreutils, automake, autoconf, libtool, intltool, wget, pkgconfig ,cmake,
gmake, yasm, grep, doxygen, ImageMagick, optipng, antlr3
STEP 1:-
Concerning these useful tools you can install the tools with this command
$sudo port install coreutils automake autoconf libtool intltool wget pkgconfig cmake gmake yasm grep doxygen ImageMagick optipng antlr3
STEP 2:-
Check out these Instructions how to upgrade nasm
STEP 3:-
Then install ant by typing
brew update #update if already installed
brew install ant
If you haven’t installed brew just type command give below
its a medium size download which takes 5 mins to download
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Just follow the process which involves installing various components. If you already have brew installed, make sure it’s up to date by executing:
brew update
Once installed you can simply type:
brew install ant
STEP 4:-
Now its time to install libtool. To install libtool run the command given below
curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar -xzf libtool-2.4.2.tar.gz
cd libtool-2.4.2
./configure && make && sudo make install
STEP 5:-
if you have not installed these programmes download and install
Download Android Studio & SDK
Download Android NDK
STEP 6:-
Download git repository of LInphone Android by running command
$ sudo git clone git://git.linphone.org/linphone-android.git –recursive
Now everything is configured perfectly
STEP 7:-
Open terminal and cd into linphone-android
Now when you get into the directory on terminal then check your PATH of SDK & NDK installed on your Mac run
$ echo $PATH
if you see the path with SDK and NDK location then it’s ok to proceed skip the below part and if not then you need to setup the PATH before you execute the make and make install script in
To setup path use:-
$export PATH=/Users/<yourusername>/android-sdks/platform-tools/:/Users//android-sdks/tools/:/Users//Documents/ndk/:/nobackup/local/prog/nasm/bin/:$PATH
it’s like export PATH=(Path of your SDK platform tools folder):(Path of your SDK tools folder):(Path of your NDK folder):$PATH
This will set up the path and to confirm again run
$ echo $PATH
Now if the Path is already setup you can simply run
$ make
Now connect your Device to you Mac and see if eclipse has detected it. After the device is connected run:
$ make install
Now if everythink is OK:-
After you have made your build then now you can import it into your Android Studio.
Open Android Studio
Import Project (Eclipse,ADT,Gradle,etc.) > select linphone-android > OK
I am able to build the limphone on mac by follow the steps describe here :-
Linphone for android is not working/missing libraries
You definetely need these tools to build linphone.
Concerning nasm I had the same problem. You can use this site that instructs you how to upgrade to a newer nasm:
Instructions how to upgrade nasm
Concerning other useful tools you can install the tools below with this command:
$sudo port install coreutils automake autoconf libtool intltool wget pkgconfig cmake gmake yasm grep doxygen ImageMagick optipng antlr3
All these are found in the linphone build instructions README.md file.

Categories

Resources