1

Hello I am new to Android and I am trying to build the hello-jni sample that is included in the NDK but I get the error below, any idea how to fix it?

15:57:10 ** Build of configuration Default for project HelloJni ** /media/Project/adt-bundle-linux-x86-20131030/adt-bundle-linux-x86-20131030/android-ndk-r9c/ndk-build all Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 3 in ./AndroidManifest.xml [armeabi-v7a] Compile thumb : hello-jni <= hello-jni.c arm-linux-androideabi-gcc: error trying to exec '/media/Project/adt-bundle-linux-x86-20131030/adt-bundle-linux-x86-20131030/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/as': execv: Exec format error make: * [obj/local/armeabi-v7a/objs/hello-jni/hello-jni.o] Error 1

15:57:10 Build Finished (took 230ms)

This is what I am using:

  • Ubuntu 10.04.4
  • ADT bundle for linux (v22.3.0-887826)
  • NDK r9c

Thanks in advance

2
  • Are you on a 64-bit system? If so, you likely need the 32-bit compatibility package to run the toolchain. An "Exec format error" usually indicates you are trying to run a binary built for a different ABI from that of your system. Commented Jan 29, 2014 at 17:11
  • I am not sure how to check if I have 32-bit or 64-bit but uname -m returned i686 which I think means 32-bit. I downloaded the following files from android developer site: adt-bundle-linux-x86-20131030.zip and android-ndk-r9c-linux-x86.tar.tar. I unpacked them on a windows machine before moving them over to my ubuntu VM because it is a bit slow, I hope that does not matter. Commented Jan 30, 2014 at 8:21

1 Answer 1

2

The WARNING is correct, and should be ignored.

Regarding the gcc error, you probably have a problem with installation of NDK. How did you unpack it? Check

ls -l /media/Project/adt-bundle-linux-x86-20131030/adt-bundle-linux-x86-20131030/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/arm-linux-androideabi/bin/as 

This should be a symbolic link to ../../bin/arm-linux-androideabi-as, and both should have executable permissions.

Sign up to request clarification or add additional context in comments.

5 Comments

I executed the ls command and got the following output: -rwxrwxrwx 1 ccs ccs 34 2013-10-09 02:53 /media/Project/adt-bundle-linux-x86-20131030/adt-bundle-linux-x86-20131030/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/arm-linux-androideabi/bin/as I checked the as-file, in a text editor, located in the bin folder and it said ../../bin/arm-linux-androideabi-as. Both the as-file and arm-linux-androideabi-as file had Allow executing file as program checked. This is correct? I unpacked the NDK on a x64 Win7 machine using 7-zip before I moved it to my ubuntu VM.
You should unpack the android-ndk-r9c-linux-x86_64.tar.bz2 in Ubuntu, and make sure that the symbolic links are preserved.
Ok I will try that, but isn't x86_64 for 64-bit machines? See the comment in my first post. I downloaded the other NDK file (32-bit).
Yes, you should use the correct bitness version of NDK. Check uname -a in your VM to decide which.
Thank you very much, unpacking directly in Ubuntu solved the problem. I noticed that the symbolic links were like text-files in the package that was unpacked in Windows.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.