title: libreactnativejni.so is built as elf32-i386 on 64bit android ndk (linux)
body: <p>EDIT: I managed to built x86_64 version of <code>libreactnativejni.so</code> (see my answer). However it didn't resolved my problem.</p>
  
  <p>To sum up what I learned here is:</p>
  
  <h2>You cannot test android components, which are using native libraries on Linux, because "libandroid.so" (core android lib), doesn't exists for Linux.</h2>
  
  <h2>Original question:</h2>
  
  <p>My goal is to run tests on my Linux box using PowerMockito similar to <a href="https://github.com/facebook/react-native/blob/master/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.java#L67" rel="nofollow noreferrer">RootViewTest.java</a>.
  Not sure how react-native team managed to run this test, but from my experience mocking <code>Arguments.createArray</code> is not possible, without loading jni library <code>reactnativejni</code>. Reason is that <code>Arguments.createArray()</code> calls <code>WritableNativeArray</code> which in static initializer <a href="https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeArray.java#L22" rel="nofollow noreferrer">ReactBridge.staticInit()</a> calls <code>SoLoader.loadLibrary("reactnativejni")</code>.</p>
  
  <p>So I thought I've no other option, but <a href="https://facebook.github.io/react-native/docs/building-from-source.html" rel="nofollow noreferrer">compile this reactnativejni shared library</a> for linux, using 64bit <a href="http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip" rel="nofollow noreferrer">android-ndk-r10e</a></p>
  
  <p>I managed to load this jni lib and test my code using:</p>
  
  <pre><code>ndkDir=$(pwd)/react-ndk/all/x86 \
    JAVA_OPTS="-Djava.library.path=\".:$ndkDir\"" \
    LD_LIBRARY_PATH="$ndkDir:$LD_LIBRARY_PATH" ./gradlew app:test
  </code></pre>
  
  <p>But test failed with:</p>
  
  <pre><code>libreactnativejni.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
  </code></pre>
  
  <p>Checked platform with objdump:</p>
  
  <pre><code>objdump -s --section .comment libreactnativejni.so
  
  libreactnativejni.so:     file format elf32-i386
  </code></pre>
  
  <p>My question how is possible that 64 bit ndk produced 32 bit library and how to force to produce 64 bit.</p>
  
  <p>Library build script is written as gradle script:</p>
  
  <p><a href="https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/ReactAndroid/build.gradle#L199" rel="nofollow noreferrer">https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/ReactAndroid/build.gradle#L199</a></p>