This sample is using swift-android-gradle and java_swift to create a brigde between Swift <-> Java wrapping JNI.
In this sample I created a Native Android Activity with its Layout and then created a listener to call the swift funcion sum()
and implemented an Interface Response to receive the response from Swift to Java.
This tool adds some gradle scripts on the build life cycle to generate Swift code and copy the binaries *.so
on jniLibs folder.
-
Download the Swift Android Toolchain.
-
Decompress the
*.tgz
and change directory to theswift-install
folder. -
Export the
ANDROID_HOME
andJAVA_HOME
paths.
export ANDROID_HOME=/Users/jmarkstar/Library/Android/sdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
- Execute
./setup