updated android/osx project and example project structure
@@ -16,7 +16,7 @@ In this example we aim to set up a minimal [Android Studio](https://developer.an
|
|||||||
|
|
||||||
**Step 2: Build Shared Library**
|
**Step 2: Build Shared Library**
|
||||||
- `make android_jni_lib`
|
- `make android_jni_lib`
|
||||||
- The resultant `build/android_jni_lib_YOUR_ARCH/libZeroTierOneJNI.so` is what you want to import into your own project to provide the API to your app. Select your architecture and copy the shared library into `YourProject/src/main/jniLibs/YOUR_ARCH/`. Selecting only the architectures you need will *significantly* reduce overall build time.
|
- The resultant `build/android_jni_lib_YOUR_ARCH/libZeroTierOneJNI.so` is what you want to import into your own project to provide the API to your app. Select your architecture and copy the shared library into your project's JNI directory, possibly `/src/main/jniLibs/YOUR_ARCH/`. Selecting only the architectures you need will *significantly* reduce overall build time.
|
||||||
|
|
||||||
**Step 3: App Code Modifications**
|
**Step 3: App Code Modifications**
|
||||||
- Create new package called `ZeroTierSDK` in your project and add a new file called `ZeroTierSDK.java` containing:
|
- Create new package called `ZeroTierSDK` in your project and add a new file called `ZeroTierSDK.java` containing:
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ LOCAL_PATH := $(call my-dir)
|
|||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
ZTSDK := ../../../../src
|
ZTSDK := ../../../../../src
|
||||||
ZT := ../../../../zerotierone
|
ZT := ../../../../../zerotierone
|
||||||
|
|
||||||
LOCAL_MODULE := ZeroTierOneJNI
|
LOCAL_MODULE := ZeroTierOneJNI
|
||||||
LOCAL_C_INCLUDES := $(ZT1)/include
|
LOCAL_C_INCLUDES := $(ZT1)/include
|
||||||
@@ -4,5 +4,11 @@ APP_CPPFLAGS := -O3 -DUSE_SOCKS_PROXY -DZT_SDK -fPIC -fPIE -fvectorize -Wall -fs
|
|||||||
APP_PLATFORM := android-14
|
APP_PLATFORM := android-14
|
||||||
|
|
||||||
# Architectures
|
# Architectures
|
||||||
APP_ABI := all
|
# APP_ABI := all
|
||||||
#APP_ABI := armeabi-v7a
|
#APP_ABI += arm64-v8a
|
||||||
|
#APP_ABI += armeabi
|
||||||
|
APP_ABI += armeabi-v7a
|
||||||
|
#APP_ABI += mips
|
||||||
|
#APP_ABI += mips64
|
||||||
|
#APP_ABI += x86
|
||||||
|
#APP_ABI += x86_64
|
||||||
@@ -31,7 +31,7 @@ android {
|
|||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
commandLine "${android.getNdkDirectory().getAbsolutePath()}/ndk-build.cmd", '-j8', '-C', file('../../java').absolutePath, "ZT1=${System.getProperty('user.dir')}/../../../../zerotierone"
|
commandLine "${android.getNdkDirectory().getAbsolutePath()}/ndk-build.cmd", '-j8', '-C', file('../../java').absolutePath, "ZT1=${System.getProperty('user.dir')}/../../../../zerotierone"
|
||||||
} else {
|
} else {
|
||||||
commandLine "${android.getNdkDirectory().getAbsolutePath()}/ndk-build", '-j8', '-C', file('../../java').absolutePath, "ZT1=${System.getProperty('user.dir')}/../../../zerotierone"
|
commandLine "${android.getNdkDirectory().getAbsolutePath()}/ndk-build", '-j8', '-C', file('../../java').absolutePath, "ZT1=${System.getProperty('user.dir')}/../../../../zerotierone"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 689 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 624 B After Width: | Height: | Size: 624 B |
|
Before Width: | Height: | Size: 774 B After Width: | Height: | Size: 774 B |
|
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 519 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |