title: android build failed with: error trying to exec .. execv: Exec format error
body: <p>here's my problem.
  i've already setup cocos2d-x 3.3.
  created new project with</p>
  
  <pre><code>cocos new Test3 -p com.MyCompany.Test3 -l cpp -d /Users/rahadiankumang/Documents/GITS/Cocos2dX
  </code></pre>
  
  <p>and try to build the project with</p>
  
  <pre><code>cocos run -s Test3 -p android
  </code></pre>
  
  <p>and here's the result :</p>
  
  <pre><code>Running command: compile
  Building mode: debug
  Android platform not specified, searching a default one...
  running: '/Users/rahadiankumang/Documents/adt-bundle-mac-x86_64-20140702/sdk/tools/android update project -t android-20 -p /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android'
  
  Updated project.properties
  Updated local.properties
  Updated file /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/proguard-project.txt
  Android platform not specified, searching a default one...
  running: '/Users/rahadiankumang/Documents/adt-bundle-mac-x86_64-20140702/sdk/tools/android update lib-project -p /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos/platform/android/java -t android-20'
  
  Updated project.properties
  Updated local.properties
  Updated file /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos/platform/android/java/proguard-project.txt
  building native
  NDK build mode: debug
  NDK_TOOLCHAIN_VERSION: 4.9
  running: '/Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/ndk-build -C /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android -j4 NDK_MODULE_PATH=/Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d:/Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos:/Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/external NDK_TOOLCHAIN_VERSION=4.9 NDK_DEBUG=1'
  
  Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml    
  make: Entering directory `/Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android'
  [armeabi] Compile++ thumb: cocostudio_static &lt;= WidgetReader.cpp
  [armeabi] Compile++ thumb: cocostudio_static &lt;= FlatBuffersSerialize.cpp
  [armeabi] Compile++ thumb: cocostudio_static &lt;= WidgetCallBackHandlerProtocol.cpp
  [armeabi] Compile++ thumb: cocos_ui_static &lt;= UILayoutComponent.cpp
  arm-linux-androideabi-g++: error trying to exec '/Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/as': execv: Exec format error
  make: *** [obj/local/armeabi/objs-debug/cocos_ui_static/UILayoutComponent.o] Error 1
  make: *** Waiting for unfinished jobs....
  arm-linux-androideabi-g++: error trying to exec '/Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/as': execv: Exec format error
  make: *** [obj/local/armeabi/objs-debug/cocostudio_static/WidgetCallBackHandlerProtocol.o] Error 1
  arm-linux-androideabi-g++: error trying to exec '/Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/as': execv: Exec format error
  make: *** [obj/local/armeabi/objs-debug/cocostudio_static/WidgetReader/WidgetReader.o] Error 1
  /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp: In member function 'std::string cocostudio::FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const string&amp;, const string&amp;)':
  /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp:153:93: warning: 'virtual unsigned char* cocos2d::FileUtils::getFileData(const string&amp;, const char*, ssize_t*)' is deprecated (declared at /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos/./platform/CCFileUtils.h:101) [-Wdeprecated-declarations]
       std::string content =(char*)FileUtils::getInstance()-&gt;getFileData(inFullpath, "r", &amp;size);
                                                                                               ^
  /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp: In member function 'flatbuffers::FlatBufferBuilder* cocostudio::FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulator(const string&amp;)':
  /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp:974:93: warning: 'virtual unsigned char* cocos2d::FileUtils::getFileData(const string&amp;, const char*, ssize_t*)' is deprecated (declared at /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android/../cocos2d/cocos/./platform/CCFileUtils.h:101) [-Wdeprecated-declarations]
       std::string content =(char*)FileUtils::getInstance()-&gt;getFileData(inFullpath, "r", &amp;size);
                                                                                               ^
  At global scope:
  cc1plus: warning: unrecognized command line option "-Wno-extern-c-compat"
  cc1plus: warning: unrecognized command line option "-Wno-extern-c-compat"
  arm-linux-androideabi-g++: error trying to exec '/Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/as': execv: Exec format error
  make: *** [obj/local/armeabi/objs-debug/cocostudio_static/FlatBuffersSerialize.o] Error 1
  make: Leaving directory `/Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android'
  Ndk build failed!
  </code></pre>
  
  <p>i'm able to import the project to Eclipse, and run it. but it crashes just after the launch with these logcats :</p>
  
  <pre><code>02-05 16:53:15.276: E/AndroidRuntime(12156): java.lang.UnsatisfiedLinkError: Couldn't load cocos2dcpp from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.MyCompany.Test3-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.MyCompany.Test3-1, /vendor/lib, /system/lib, /system/lib/arm]]]: findLibrary returned null
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at java.lang.Runtime.loadLibrary(Runtime.java:358)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at java.lang.System.loadLibrary(System.java:526)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:85)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:99)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.app.Activity.performCreate(Activity.java:5411)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2396)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.app.ActivityThread.access$800(ActivityThread.java:139)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.os.Handler.dispatchMessage(Handler.java:102)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.os.Looper.loop(Looper.java:149)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at android.app.ActivityThread.main(ActivityThread.java:5268)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at java.lang.reflect.Method.invokeNative(Native Method)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at java.lang.reflect.Method.invoke(Method.java:515)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
  02-05 16:53:15.276: E/AndroidRuntime(12156):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>i've tried to build the project with build_native.py but it also failed too.</p>
  
  <p>here's the result</p>
  
  <pre><code>We will remove this script next version,you should use cocos console to build android project.
  
  The Selected NDK toolchain version was 4.9 !
  Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml    
  make: Entering directory `/Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android'
  [armeabi] Compile++ thumb: cocos2dcpp_shared &lt;= AppDelegate.cpp
  [armeabi] Compile++ thumb: cocos2dcpp_shared &lt;= HelloWorldScene.cpp
  [armeabi] Compile++ thumb: cocos2dcpp_shared &lt;= main.cpp
  [armeabi] StaticLibrary  : libcocos2d.a
  /Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ar: line 1: ../../bin/arm-linux-androideabi-ar: No such file or directory
  make: *** [obj/local/armeabi/libcocos2d.a] Error 127
  make: *** Waiting for unfinished jobs....
  arm-linux-androideabi-g++: error trying to exec '/Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/as': execv: Exec format error
  make: *** [obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/AppDelegate.o] Error 1
  arm-linux-androideabi-g++: error trying to exec '/Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/as': execv: Exec format error
  make: *** [obj/local/armeabi/objs-debug/cocos2dcpp_shared/hellocpp/main.o] Error 1
  arm-linux-androideabi-g++: error trying to exec '/Users/rahadiankumang/Documents/GITS/Cocos2d-x/android-ndk-r10d/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/as': execv: Exec format error
  make: *** [obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o] Error 1
  make: Leaving directory `/Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android'
  Traceback (most recent call last):
    File "./build_native.py", line 149, in &lt;module&gt;
      build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
    File "./build_native.py", line 134, in build
      do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
    File "./build_native.py", line 70, in do_build
      raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
  Exception: Build dynamic library for project [ /Users/rahadiankumang/Documents/GITS/Cocos2dX/Test3/proj.android ] fails!
  </code></pre>
  
  <p>i'm just started with cocos2d-x today, and don't really familiar with Android NDK.</p>
  
  <p>Have someone encountered this ?
  i've searching for similar problem but no result yet.</p>
  
  <p>NDK r10d
  <br/>SDK API 20</p>
  
  <p>thank you.</p>