You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ANDROID_NDK_HOME silently overrides the Android Gradle plugin's NDK #19
MikroSoundFont's published 0.4.0 and 0.4.1 AARs shipped 4 KB aligned Android libraries although the project (and its publish workflow) used NDK 28, which aligns to 16 KB pages by default. Local builds were correct; only CI builds were wrong.
The publish log shows every Android library built with /Users/runner/Library/Android/sdk/ndk/27.3.13750724. GitHub's macOS and Ubuntu runner images preset ANDROID_NDK_HOME to that NDK, and KonanConfig.resolve ranks the sources for androidNdk as:
konan { config { androidNdk } }
Gradle property androidNdk
ANDROID_NDK_HOME
the NDK the module's Android Gradle plugin uses (android.ndkVersion, else AGP's default)
So in an Android module, an environment variable the user never set beats the NDK the module's own build declares, without any message. The Kotlin code (AGP) and the native libraries (KonanPlugin) can end up on different NDKs.
Worked around in lemcoder/MikroSoundFont#7 by pointing ANDROID_NDK_HOME at NDK 28 in the workflows and checking alignment before publishing.
Proposal
In a module with the Android Gradle plugin, rank AGP's NDK above ANDROID_NDK_HOME:
DSL
Gradle property
AGP's NDK (when AGP is applied and that NDK is installed)
ANDROID_NDK_HOME
Explicit choices made in the build (DSL, Gradle property, android.ndkVersion) then win over ambient machine state, and ANDROID_NDK_HOME stays the fallback for modules without AGP.
At minimum, log a warning when ANDROID_NDK_HOME is used and differs from AGP's NDK, naming both paths, and show the source in konanConfig output (it already records ConfigSource).
Acceptance
A test with AGP applied and ANDROID_NDK_HOME set to a different NDK resolves androidNdk to AGP's NDK (or, for the warning-only variant, emits the warning).
Activity