leveldown-android-prebuilt v2.0.3
leveldown-android-prebuilt
A simple fork of leveldown that adds Android (non-cross) compilation and publishes the native prebuilt libraries on npm.
This is a hacky and temporary solution
Eventually, we should just use the official leveldown with
cross-compilation to Android.
How to use this package
We assume you are using react-native-node where your Node.js process will
require leveldown, but this package may work with other Node.js-in-Android
approaches.
You either need to change all explicit require('leveldown') to
require('leveldown-android-prebuilt') or use a replacement preprocessor, for
instance noderify --replace.leveldown=leveldown-android-prebuilt if you are
using noderify.
If you are using react-native-node then you are using React Native (...you
don't say) and leveldown depends on the shared library libc++_shared.so. You
can find this .so from Termux under /usr/lib and you can copy it to your
computer using scp (see the maintainer's guidelines below). In your Android
project you should insert that .so under
android/app/src/main/jniLibs/armeabi-v7a/ (or some other
...armeabiSOMETHING) and then react-native-node v3.3.0+ knows how to find
the .so in runtime.
How to maintain this package
This package is intended to work with react-native-node which currently (as of react-native-node v3.3.0) runs Node.js v7.1.0. This is why we will compile leveldown targetting 7.1.0.
- Install and open Termux on an Android device
- Run
uname -mand check whether the device is armv7 or arm64 - git clone this repo in Termux
- Run
prebuild --verbose --target=7.1.0 - Set up SSH access to that device (necessary for the next step)
scpcopy/data/data/com.termux/files/home/leveldown/build/Release/leveldown.nodeto your computer- Put that
leveldown.nodein this repo's directory./compiled/7.1.0/android/armSOMETHINGwherearmSOMETHINGisarmorarm64depending on what you got from step 2 - npm publish this repo