How to extract the Android NDK package?

4k views Asked by At

My OS is CentOS 32-bit.

I want to extract the package with 7-zip, install 7-zip with rpm without error. but when I extract the NDK package,it doesn't work. like this:

[root@localhost ~]# ls
anaconda-ks.cfg                 jni-test
android-ndk-r10e-linux-x86.bin  p7zip-9.20.1-1.el5.rf.i386.rpm
install.log                     p7zip-plugins-9.20.1-1.el5.rf.i386.rpm
install.log.syslog
[root@localhost ~]# 7z x android-ndk-r10e-linux-x86.bin 

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=zh_CN.UTF-8,Utf16=on,HugeFiles=on,1 CPU)

Processing archive: android-ndk-r10e-linux-x86.bin

Error: Can not open file as archive

According to Google's official document operation:

[root@localhost ~]# ll
总用量 307344
-rw-------. 1 root root      1096 6月  25 17:41 anaconda-ks.cfg
-rwxr-xr-x. 1 root root 309844799 6月  25 21:24 android-ndk-r10e-linux-x86.bin
-rw-r--r--. 1 root root      9119 6月  25 17:41 install.log
-rw-r--r--. 1 root root      3091 6月  25 17:41 install.log.syslog
drwxr-xr-x. 2 root root      4096 6月  25 20:04 jni-test
-rw-r--r--. 1 root root   4455529 4月  20 2011 p7zip-9.20.1-1.el5.rf.i386.rpm
-rw-r--r--. 1 root root    382577 4月  20 2011 p7zip-plugins-9.20.1-1.el5.rf.i386.rpm
[root@localhost ~]# ./android-ndk-r10e-linux-x86.bin 

7-Zip SFX 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=zh_CN.UTF-8,Utf16=on,HugeFiles=on,1 CPU)

Processing archive: ./android-ndk-r10e-linux-x86.bin

Error: Can not open file as archive

Archive Errors: 1
[root@localhost ~]# file android-ndk-r10e-linux-x86.bin 
android-ndk-r10e-linux-x86.bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, stripped

Why?

UPDATE: The cause of this problem is that the MD5 value is not the same.

2

There are 2 answers

0
alijandro On

If it's 7zip format package, you can extract it with 7zip. But it is not, you can see the format from the file command.

$ file android-ndk-r10e-linux-x86_64.bin 
android-ndk-r10e-linux-x86_64.bin: ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=8c7de897dd2f5d869d108bed2f2152a68b2f7b0a, stripped

From the output result above, we can see that it's a ELF executable, so just add the executable bit and execute it.

$ chmod u+x android-ndk-r10e-linux-x86_64.bin
$ ./android-ndk-r10e-linux-x86_64.bin

It will extract to the directory android-ndk-r10e under current directory.

0
isma3l On

It's a self extract binary. You don't need 7Zip, just chmod a+x and ./android-ndk-r10e-linux-x86.bin

UPDATE

I see that you have tried that in your update , now according to the doc https://developer.android.com/ndk/downloads/index.html , i think that your file is corrupted just by seeing the size 309844799 vs 394281908 expected, you don't even have to check the md5.

Download again , check the md5 of the file and retry extracting.