Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/of.yml
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,10 @@ jobs:
TARGET: ${{ matrix.cfg.target }}
ARCH: ${{ matrix.cfg.opt }}
ANDROID_SDK_ROOT: $ANDROID_HOME
ANDROID_NDK_ROOT: $ANDROID_NDK_LATEST_HOME
# keep in sync with apothecary build-android.yml (NDK r29, min API 25);
# cmake.sh resolves $ANDROID_HOME/ndk/$NDK, gradle uses ndkVersion
NDK: "29.0.14206865"
ANDROID_API: "25"

steps:
- name: checkout openFrameworks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ if(NOT DEFINED HOST_PLATFORM)
else()
message(FATAL_ERROR "Unsupported host platform: ${CMAKE_HOST_SYSTEM_NAME} (${CMAKE_HOST_SYSTEM_PROCESSOR})")
endif()
# NDKs up to at least r29 ship only darwin-x86_64 (universal binaries) and
# linux-x86_64; use an arm64 host folder only when the NDK actually has one.
if(NOT EXISTS "${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${HOST_PLATFORM}")
string(REPLACE "-arm64" "-x86_64" HOST_PLATFORM_FALLBACK "${HOST_PLATFORM}")
if(EXISTS "${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${HOST_PLATFORM_FALLBACK}")
set(HOST_PLATFORM "${HOST_PLATFORM_FALLBACK}")
endif()
endif()
endif()

message(STATUS "Android ABI: ${ANDROID_ABI}")
Expand Down
30 changes: 21 additions & 9 deletions libs/openFrameworksCompiled/project/android/cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ APOTHECARY_LEVEL="$(cd "$SCRIPT_DIR/../.." && pwd)"
export MAKE_TARGET="${MAKE_TARGET:-cmake}"
export CPP_STANDARD="${CPP_STANDARD:-23}"
export C_STANDARD="${C_STANDARD:-17}"
export NDK_VERSION_MAJOR="${NDK_VERSION_MAJOR:-27}"
export ANDROID_API="${ANDROID_API:-34}" #minimum Android API supported. 34 default
ANDROID_PLATFORM="android-34" # Usually must be >= 24 for modern libraries and NDKs.
# Keep in sync with apothecary (.github/workflows/build-android.yml, configure/android_configure.sh)
export NDK="${NDK:-29.0.14206865}" # pinned NDK (major.minor.build) under $ANDROID_SDK_PATH/ndk
export NDK_VERSION_MAJOR="${NDK_VERSION_MAJOR:-${NDK%%.*}}"
export ANDROID_API="${ANDROID_API:-25}" # min compile API (Android 7.1). Not the SDK version.
ANDROID_PLATFORM="android-${ANDROID_API}"
DEFAULT_ARCHS="armeabi-v7a arm64-v8a x86_64"
TOOLCHAIN_FILE="$(pwd)/../CMake/toolchain/android.toolchain.cmake"
CMAKELISTS_DIR="$(pwd)/openframeworksAndroid"
Expand All @@ -37,7 +39,7 @@ else
fi
if [[ "$OS_TYPE" == "macOS" ]]; then
echo "Running on macOS"
export ANDROID_SDK_PATH="$HOME/Library/Android/sdk"
export ANDROID_SDK_PATH="${ANDROID_HOME:-${ANDROID_SDK_ROOT:-$HOME/Library/Android/sdk}}"
elif [[ "$OS_TYPE" == "Windows" ]]; then
echo "Running on Windows (Git Bash)"
WIN_USER=$(whoami)
Expand All @@ -63,13 +65,23 @@ else
exit 1
fi

# Find latest NDK inside the SDK directory
ANDROID_NDK_PATH=$(ls -d "$ANDROID_SDK_PATH/ndk/"* 2>/dev/null | sort -V | tail -n 1)
export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH
# NDK: the pinned $NDK under the SDK, else ANDROID_NDK_ROOT / ANDROID_NDK_HOME.
# Never fall back to "newest folder" silently: a newer or half-installed NDK
# (no source.properties) builds a core that doesn't match the apothecary libs.
ANDROID_NDK_PATH=""
if [ -f "$ANDROID_SDK_PATH/ndk/$NDK/source.properties" ]; then
ANDROID_NDK_PATH="$ANDROID_SDK_PATH/ndk/$NDK"
elif [ -n "${ANDROID_NDK_ROOT:-}" ] && [ -f "$ANDROID_NDK_ROOT/source.properties" ]; then
ANDROID_NDK_PATH="$ANDROID_NDK_ROOT"
elif [ -n "${ANDROID_NDK_HOME:-}" ] && [ -f "$ANDROID_NDK_HOME/source.properties" ]; then
ANDROID_NDK_PATH="$ANDROID_NDK_HOME"
fi
if [ -n "$ANDROID_NDK_PATH" ]; then
echo "Latest Android NDK found at: $ANDROID_NDK_PATH"
export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH
echo "Android NDK: $ANDROID_NDK_PATH ($(grep -m1 Pkg.Revision "$ANDROID_NDK_PATH/source.properties" | cut -d= -f2 | tr -d ' '))"
else
echo "No NDK found inside SDK directory."
echo "Android NDK $NDK not found in $ANDROID_SDK_PATH/ndk (and ANDROID_NDK_ROOT / ANDROID_NDK_HOME not set)."
echo "Install it with: sdkmanager \"ndk;$NDK\" or set NDK=<installed version>"
exit 1
fi
ANDROID_CMAKE_PATH=$(ls -d "$ANDROID_SDK_PATH/cmake/"* 2>/dev/null | sort -V | tail -n 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ tasks.register("prepareKotlinBuildScriptModel"){}
android {
namespace 'cc.openframeworks.android'
compileSdkVersion 34
ndkVersion '28.2.13676358'
buildToolsVersion '35.0.0'
ndkVersion '29.0.14206865'
buildToolsVersion '37.0.0'

defaultConfig {
minSdkVersion 34
minSdkVersion 25
targetSdkVersion 34
versionCode 12
versionName "12"
Expand Down
6 changes: 3 additions & 3 deletions scripts/templates/android/ofApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ println "Include directories: " + addonIncludeDirs

android {
compileSdkVersion 34
buildToolsVersion '35.0.0'
buildToolsVersion '37.0.0'
//ndkPath "/Users/x/android-ndk-r21e" // Point to your own NDK if needed
ndkVersion '28.2.13676358' // use android studio side loaded ndk
ndkVersion '29.0.14206865' // keep in sync with apothecary build-android.yml
buildFeatures {
prefab true
}
Expand All @@ -189,7 +189,7 @@ android {
}
defaultConfig {
applicationId "cc.openframeworks.androidAssimpExample" // IMPORTANT : THIS DEFINES THE ID OF THE APK
minSdkVersion 24
minSdkVersion 25
targetSdkVersion 34
versionCode 12
versionName '12.0'
Expand Down
Loading