forked from kikitte/GDAL4Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Build Changes
Andy Crampton edited this page Sep 9, 2025
·
2 revisions
Several significant changes were required to modernize the project from the original kikitte/GDAL4Android fork and ensure a successful build on modern hardware and toolchains.
The Android project structure was modernized to align with current standards:
- Gradle Wrapper: Upgraded to a recent version.
-
Kotlin DSL: The
build.gradlefiles were converted tobuild.gradle.kts, the modern standard for Gradle build scripts. - Java Version: The project now targets Java 17.
-
Android SDK: The
compileSdkwas updated to 35. -
IDE Files:
.ideaand.imlfiles were updated for a more recent Android Studio version.
- 16kb Page Size is Now Default: The original build script had an option for different page sizes. Now that Google is requiring 16kb page sizes, the 16kb page size is now the default and only option.
- NDK Version 27: The project was updated to use NDK version 27.x. This is crucial for compatibility, as it matches the NDK version used by the Mapbox SDK, preventing potential runtime conflicts with native libraries.
The most significant changes were made to the C++ build script to enable cross-compilation on Apple Silicon (aarch64) hosts and to fix linking issues. Details can be found on the Build Script Overview page.
-
Host Architecture Resilience: The script now automatically detects the host machine's architecture (e.g.,
aarch64-apple-darwinfor Apple Silicon,x86_64-linux-gnufor Linux) and sets the correctHOSTvariable for build tools likeconfigure. This makes the script runnable on different developer machines without manual changes. -
Shared Libraries (
.so): The build process was changed to produce shared libraries (.so) instead of static archives (.a). While static linking is often preferred, it proved difficult to get the final GDAL library to correctly link all of its static dependencies. Building and linking shared libraries resolved these complex linker errors. -
SQLite Amalgamation: The build process for SQLite was switched from using the
autoconfscript to using the amalgamation. The amalgamation is a single, large C source file containing the entire SQLite library. This was done because theautoconfscript is designed to inspect the host system and often fails when cross-compiling for a different target like Android. The amalgamation simplifies the build process immensely by removing the need for a complex configuration step. -
Added
libpngDependency: The PNG library was added as a required dependency. This is because theRasterReader.ktclass in the app uses apngDatahelper method to serve map tiles. This method internally uses GDAL's PNG driver to translate the raw raster data into a standard PNG image format that Mapbox can render. Withoutlibpngcompiled into GDAL, the PNG driver is unavailable, and the app cannot generate tiles.