Skip to content

Commit 1e0f6b0

Browse files
committed
Fix issue with incorrect native libraries for the JNA.
The JNA jar as provided by the Maven Central does not contain valid Android libraries. The project provides Android-suitable libraries in their GitHub repo: https://github.com/java-native-access/jna/tree/master/lib/native
1 parent a0d20e9 commit 1e0f6b0

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

java/pom.xml

+23
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
<artifactId>jna</artifactId>
3333
<version>${jna.version}</version>
3434
</dependency>
35+
<dependency>
36+
<groupId>net.java.dev.jna</groupId>
37+
<artifactId>android-arm</artifactId>
38+
<version>${jna.version}</version>
39+
</dependency>
3540
<dependency>
3641
<groupId>junit</groupId>
3742
<artifactId>junit</artifactId>
@@ -68,6 +73,24 @@
6873
<target>1.7</target>
6974
</configuration>
7075
</plugin>
76+
<plugin>
77+
<groupId>org.apache.maven.plugins</groupId>
78+
<artifactId>maven-dependency-plugin</artifactId>
79+
<executions>
80+
<execution>
81+
<id>resource-dependencies</id>
82+
<phase>process-sources</phase>
83+
<goals>
84+
<goal>unpack-dependencies</goal>
85+
</goals>
86+
<configuration>
87+
<includeArtifactIds>android-arm</includeArtifactIds>
88+
<includes>libjnidispatch.so</includes>
89+
<outputDirectory>libs/armeabi</outputDirectory>
90+
</configuration>
91+
</execution>
92+
</executions>
93+
</plugin>
7194
</plugins>
7295
<pluginManagement>
7396
<plugins>

rust-build/libs/android-arm.jar

43.4 KB
Binary file not shown.

rust-build/pre_build_rust_keylock_android.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ cd android-toolchain
2828
ANDROID_TOOLCHAIN_DIR=`pwd`
2929
echo Android toolchain set in $ANDROID_TOOLCHAIN_DIR
3030

31+
# Install the jar containing the jna native library for Android (taken from https://github.com/java-native-access/jna/tree/master/lib/native)
32+
echo "Installing jar android-arm.jar in the local Maven... This jar is not provided in the Maven Central, rather by the project's GitHub repo."
33+
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=${BASEDIR}/rust-build/libs/android-arm.jar -DgroupId=net.java.dev.jna -DartifactId=android-arm -Dversion=4.4.0 -Dpackaging=jar
34+
3135
# Go to the .cargo directory
3236
cd $BASEDIR/rust
3337
mkdir .cargo
3438
cd .cargo
3539
CURR_DIR=`pwd`
3640
echo Entered directory $CURR_DIR
3741

38-
#Create a config file
42+
# Create a config file
3943
cat > config << EOF
4044
[target]
4145
[target.arm-linux-androideabi]

0 commit comments

Comments
 (0)