libsodium-jni icon indicating copy to clipboard operation
libsodium-jni copied to clipboard

Build for host only, without Android SDK installed

Open jamesrgrinter opened this issue 5 years ago • 1 comments

I'd like to be able to build the JNI library for only the local host (compileNative_host), without having to have an Android SDK installed. I'm not interested in building Android archives or running this on Android.

It looks like this is meant to work. Naively running ./build-mac.sh, I got the error message:

...
gradle tasks --all

> Configure project :
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /usr/local/share/android-ndk.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

but after heeding that advice (I edited setenv.sh, and commented out every ANDROID_SDK variable) it still doesn't work:

gradle tasks --all

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file '/Users/jrg/Source/libsodium-jni/build.gradle' line: 233

* What went wrong:
A problem occurred evaluating root project 'libsodium-jni'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

and further attempts after removing more Android references from build.gradle make no progress. (Tried with both gradle 4.2 and gradle 5.3.1.)

I assume there are some build steps within the build.gradle that have come to rely upon something in the NDK?

jamesrgrinter avatar Apr 15 '19 15:04 jamesrgrinter

Running all tasks will have an Android dependency. build.gradle in this repository is meant for use in conjunction with Android.

compileNative_host was removed as the host compilation is managed upstream by the libsodium project.

The task generateSWIGsource might be what you are looking for. You can try executing those commands independently.

build.gradle has the android plugin at line 2 and android declarations.

You can try also looking at the various shell scripts that do not have gradle as a hard dependency.

joshjdevl avatar Apr 27 '19 11:04 joshjdevl