Reputation: 622
I have downloaded android NDK from here: http://developer.android.com/tools/sdk/ndk/index.html
for Linux 64-bit (x86) android-ndk-r10c-linux-x86_64.bin. How I do install it? The instructions don't work.
My OS is
57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Upvotes: 37
Views: 103868
Reputation: 689
Use android cli tool sdkmanager. It's recommend to install the NDK side-by-side to your SDK, that means you should install the NDK under$ANDROID_SDK_ROOT/ndk
. If you use a build tool like Gradle you can specify your version via build.gradle
and it will download/install if the NDK is missing into Android SDK direktory during build process. If you want to install NDK manually you can run (replace version no with the version of your choice):
sudo env "PATH=$PATH" sdkmanager --install "ndk;25.1.8937393" --sdk_root=$ANDROID_SDK_ROOT --verbose
Upvotes: 0
Reputation: 673
Upvotes: 1
Reputation: 11
you can use sdkmanager, below is the detail code;
wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O android-sdk.zip
unzip android-sdk.zip -d .
rm -f android-sdk.zip
mkdir -p /opt/android-sdk/ # you can choose the folder to install all the android sdk\ndk\build-tools ...
mv ./tools/ /opt/android-sdk/
export ANDROID_HOME="/opt/android-sdk"
export PATH="${ANDROID_HOME}/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:${PATH}"
yes | sdkmanager --licenses
sdkmanager "platforms;android-27"
...
Upvotes: 1
Reputation: 7718
Another way to download and install (unpack) it (size of zip is ~820MB, unzipped is ~2.9G):
wget https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip
unzip android-ndk-r20-linux-x86_64.zip
Upvotes: 9
Reputation: 4375
If you already have AndroidStudio installed:
You can install NDK using the SDK Manager from within Android Studio
From an open project, select Tools > Android > SDK Manager from the menu bar. Click the SDK Tools tab. Check the boxes next to LLDB, CMake, and NDK. Apply
Upvotes: 9
Reputation: 5525
The Standard Way
Android's NDK now ships as an self extracting executable. You likely need to set the executable bit:
$ chmod +x android-ndk-r10c-linux-x86_64.bin
$ ./android-ndk-r10c-linux-x86_64.bin
The above will cause the NDK to extract into the current working directory.
Manual Extraction
Since the .bin file is really just a 7-Zip self extracting archive, you can manually extract the contents if needed:
$ 7za x -o/path/to/extract/to/ android-ndk-r10c-linux-x86_64.bin
7-Zip is available in Ubuntu for example via apt-get:
$ sudo apt-get install p7zip-full
Update
As of at least r14b on the NDK download page, we're back to standard ZIP archives.
Upvotes: 37
Reputation: 21
I have androidBBQ which is archlinux based, installed using vmware. But I guess my instructions should be the same for any linux distribution. I used AndroidStudio's built-in SDK manager, to try installing NDK. Download failed because there was no space in /tmp. Turns out that most Linux distros have ramdisk baesd tmpfs (temporary file system in RAM which is mounted at /tmp) and there is no separate partition which could be extended. /tmp is mounted usually by using 50% of available RAM.
Install NDK using Android Studio's built-in SDK manager ->not so convenient
a) Extend /tmp
I edited my fstab as root, using this command :
sudo nano /etc/fstab
I appended this line to my fstab
none /tmp tmpfs size=8G 0 0
Note: If no such line exists, add above line at end of fstab. If any such line exists, it means you had already extended your /tmp and it was still insufficient. So, only change the "size" value, by raising it by a few GBs.
Then I rebooted. Once I did, my /tmp was extended to 8GB size. For development purposes, I guess we should readily extend our /tmp because we will have to do it anyway some time later. Size of /tmp is not dependent on free space in our hard disk (whether virtual or physical).
b) run NDK install again
I ran the NDK install from within AndroidStudio again. It had to download the NDK zip afresh. Unfrotunate that there is no resume/recheck function to resurrect broken installs. My download speed was slow, so I minimized the virtual linux's window and continued to read news. Later, I guess memory/page swapping occurred. The download failed. I restarted Linux and restarted NDK install the same way. This time, I let the virtual Linux machine stay on foreground. NDK installed fine with this log :
Installing NDK
Downloading https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
Installing NDK in /opt/android-sdk/ndk-bundle
Manual NDK install in Linux (preferable) I am amazed that official Android dev section did not bother indicating exact install location of Android NDK. Android Studio looks for NDK at:
/opt/android-sdk/ndk-bundle
So, do this:
1. Download NDK zip from https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
2. Open the zip, and open the android-ndk-r12b-linux-x86_64 (or similar) folder present inside.
3. Now extract all these files and folders to /opt/android-sdk/ndk-bundle
.
4. Launch Android Studio, and it should detect presence of NDK.
Upvotes: 1
Reputation: 27545
I have done like below
Install 7-Zip via apt-get
like this
$ sudo apt-get install p7zip-full
go to folder where your ndk bin is and then execute the command
$ 7z x *bin
Upvotes: 1
Reputation: 61
Ubuntu will error:bash: ./android-ndk-r10c-linux-x86_64.bin: No such file or directory
slove: apt-get install p7zip-full
7z x *bin
Upvotes: 0
Reputation: 336
Go to the directory where you downloaded it. Then execute:
chmod +x android-ndk-r10c-linux-x86_64.bin
./android-ndk-r10c-linux-x86_64.bin
It should unpack right there. The toolchain will be in android-ndk-r10c-linux-x86_64/toolchains. The root folder might have a slightly different name.
Upvotes: 3