First, download the Android NDK
Android NDK Official download page:http://developer.android.com/tools/sdk/ndk/index.html
If you need an older version, such as the 10b version, 64-bit Linux, you can directly knock http://dl.google.com/android/ndk/android-ndk32-r10b-linux-x86_64.tar.bz2
>> "Ndk32": 32-bit target version, want 64-bit replaced by "ndk64";
>> "r10b": Version of NDK;
>> "linux-x86_64": Used on 64-bit Linux, if you want 32-bit Linux, replace it with "linux-x84"; If you want a 64-bit Mac, replace it with "darwin-x86_64".
Download it and unzip it, then add the ndk-build command to the environment variable
1 $nano ~/bashrc2 #在文件的末尾加上: Export path= $PATH:/home/xyj/android-ndk32-r10b 3 $source. BASHRC
Second, cross-compiling tools
Step1, download
1$CD/HOME/XYJ/ANDROID-NDK-r10b 2$./build/tools/make-standalone-toolchain.sh--system=linux-x86_64--toolchain=arm-linux-androideabi-4.83 #回车之后输入以下内容就是成功了 4 Copying prebuilt binaries ... 5 Copying sysroot Headers and libraries ... 6Copying libstdc++headers and Libraries ...7Creating Package File:/tmp/ndk-xyj/arm-linux-androideabi-4.8 . tar.bz2 8 Cleaning up ... 9Done.
Step2, unzip to the path $aaa you want, and add the toolchain to the environment variable:
$nano ~/. bashrc# at the end of the file add: Export PATH= $PATH: $AAA/arm-linux-androideabi-4.8/Bin$source. BASHRC
Step3. Detect if the installation was successful
Way1:
$arm #双tab
Show the following:
Way2:
$arm-linux-androideabi-gcc-v #能显示正确信息 $arm-linux-androideabi-g++-v #能显示正确信息
Ubuntu builds Android cross-compilation environment