Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we declare the JNA dependency in our Gradle project, we do it like so:
Note the
@aar
. From my investigations, only the AAR version of JNA inlcudes the Android platform builds (aarch64, armv7, x86-64, x86) of the necessaryjnidispatch
native library.But due what seems to be an issue with Jitpack, the information about using the AAR instead of the JAR is dropped by Jitpack from our module definition file.
From what I can tell, that means that when using Jitpack, the JAR version of JNA will be used and therefore the versions of
jnidispatch
that are needed on the Android platform are missing. Therefore we get the following error when running Android apps:A solution to this (based on this SO answer) is to manually download and include
jnidispatch
in the build. That way the necessary native libraries for the Android platform can be found. We already explicitly includelibc++_shared.so
so I think includinglibjnidispatch.so
should be fine.Size-wise, this adds about 400KB to the package.
When installing the Breez SDK from other package repositories (our custom one, GitHub), this is not an issue. There, the information to use the AAR version of JNA is kept and we don't run into the "libjnidispatch.so not found" issue. From my tests, manually including
jnidispatch
doesn't break builds installed from these repositories either. It doesn't seem to cause any duplicate symbols or other errors.How to Test
Add the Jitpack repository
Then add the Breez SDK. The
c6f838bd89
is equivalent to the 0.1.3 release + this fix:Why Jitpack
In React Native projects, Jitpack is a default repository. That means users don't need to manually add a repository when installing the Breez SDK plugin.