|
1 | | -This is currently the most robust and straightforward way of making Android apps that incorporate LSL. These instructions apply to Android Studio 3.1.2. You will need to get jna-4.2.2.jar (from https://mvnrepository.com/artifact/net.java.dev.jna/jna/4.2.2) and put it in LSL/liblsl-Android/AndroidStudio/libs. You will need to get the native jna libraries from https://github.com/java-native-access/jna/tree/4.2.2/lib/native. Select branch 4.2.2 and download android-*.jar. Extract each of these jars, using 7-zip or similar, and create the following directory tree: |
2 | | -LSL/liblsl-Android/AndroidStudio/jniLibs |
3 | | - arm64-v8a |
4 | | - libjnidispatch.so |
5 | | - armeabi |
6 | | - libjnidispatch.so |
7 | | - armeabi-v7a |
8 | | - libjnidispatch.so |
9 | | - mips |
10 | | - libjnidispatch.so |
11 | | - mips64 |
12 | | - libjnidispatch.so |
13 | | - x86 |
14 | | - libjnidispatch.so |
15 | | - x86_64 |
16 | | - libjnidispatch.so |
17 | | - |
18 | | -Yes the platform names are different in the jar files than in the required the directory structure, and yes the names are important. If you do this incorrectly, you get errors related to "missing libjnidispatch.so". |
19 | | - |
20 | | -If you get errors related to native, built in functions such as fgetpos and fsetpos in cstdio, this implies a problem with the version of the ndk that you are using (revision 15c and 16b are broken for several platforms). Download Revision 14b from https://developer.android.com/ndk/downloads/older_releases.html to a volume with a lot of space (it is 2.36 GB). In Android Studio, go to File -> Project Structure -> SDK Location -> Android NDK location and set the path to point at android-ndk-r14b. |
21 | | - |
22 | | -To run, select the desired module from the list box the the left of the green arrow, and click the green arrow. |
23 | | - |
24 | | -The majority of the native build instructions are in CMakeLists.txt, with some in the project build.gradle files. |
25 | | - |
26 | | -At this point, every module rebuilds its own version of liblsl.so. Hopefully Android Studio will one day support building a purely native library without redundancy. |
27 | | - |
28 | | -If you would like to use LSL in an android app built in a different way, it is recommended that you build one project (such as ReceiveStringMarkers) and extract the needed compiled library files from the .apk file (using 7-zip or similar). |
29 | | - |
30 | | -To make other Apps in Android Studio, the easiest way is to exit Android Studio, copy the SendStringMarkers folder and change every reference to SendStringMarkers in the copied folder to a new name (using a text editor). |
31 | | - |
32 | | -To see more examples of Java with LSL, look in LSL/liblsl-Java. Those examples should copy of to Android with minimal effort. |
33 | | - |
34 | | - |
| 1 | +This is currently the most robust and straightforward way of making Android apps that incorporate LSL. These instructions apply to Android Studio 3.2.0. |
| 2 | + |
| 3 | +jna 4.5.0 is automatically downloaded and included, so just in case something goes wrong you'll have to make sure your APK has `libjnidispatch.so` and `liblsl.so` in all CPU architecture dependent subdirectories of `lib`, e.g. |
| 4 | + |
| 5 | +[your apk]/lib |
| 6 | + arm64-v8a |
| 7 | + libjnidispatch.so |
| 8 | + liblsl.so |
| 9 | + armeabi |
| 10 | + libjnidispatch.so |
| 11 | + liblsl.so |
| 12 | +... |
| 13 | + |
| 14 | +To run, select the desired module from the list box the the left of the green arrow, and click the green arrow. |
| 15 | + |
| 16 | +The majority of the native build instructions are in `../liblsl-Java/build.gradle` and `../liblsl/CMakeLists.txt`. |
| 17 | + |
| 18 | +At this point, liblsl.so is built once for each target cpu architecture. |
| 19 | + |
| 20 | +If you would like to use LSL in an android app built in a different way, it is recommended that you build one project (such as ReceiveStringMarkers) and extract the needed compiled library files from the .apk file (using 7-zip or similar). |
| 21 | + |
| 22 | +To make other Apps in Android Studio, the easiest way is to exit Android Studio, copy the SendStringMarkers folder and change every reference to SendStringMarkers in the copied folder to a new name (using a text editor). |
| 23 | + |
| 24 | +To see more examples of Java with LSL, look in LSL/liblsl-Java. Those examples should copy of to Android with minimal effort. |
| 25 | + |
| 26 | + |
0 commit comments