title: Writeable and Executable location on Android
body: <p>I've compiled a binary using the Android NDK toolchain, and am attempting to deploy it to a device. An application which has been built with the NDK using JNI will then execute this binary via native code. I'm hoping to avoid rooting the device.</p>
  
  <p>The binary will be used by multiple applications, so I'd like to store it in a shared location, rather than once per application.</p>
  
  <p>I can't find an appropriate location to deploy this binary to - these are the places I've tried:</p>
  
  <ol>
  <li><p><strong>/mnt/sdcard</strong> - using <em>getExternalStoragePublicDirectory()</em> from the SDK, however the SD card is mounted as noexec, meaning I can't run it.</p></li>
  <li><p><strong>/system/bin</strong> - read-only file system, so can't copy. I can push the file using adb push if I remount /system on the emulator using:</p>
  
  <pre><code>mount -o rw,remount -t yaffs2 /dev/block/mtd3 /system
  </code></pre>
  
  <p>However I'd like to avoid this, as the device would need to be rooted.</p></li>
  <li><p><strong>/data/local</strong> - using adb push, I can push the binary to this location. However, I can't seem to find a way to do this in code (using the Android SDK). The internal storage mechanism points to <em>/data/data/package</em>.</p></li>
  </ol>
  
  <p>I've compiled native code which calls this executable, using <em>arm-linux-androideabi-g++</em> shipped with the NDK toolchain. This works with the binary in <em>/system/bin</em> and <em>/data/local</em>. </p>
  
  <p>In summary, I'm looking for a location in the Android file system to which I can copy a file from the project /assets folder, which world-executable permissions are possible.</p>