SDL2 android-project (from source code) fails to build with NDK 21.1.6352462

I tried to build the android-project from SDL2 source code using the Android Studio on Linux, but it fails to build with NDK 21.1.6352462. I get the following error message:

    Executing tasks: [:app:assembleDebug] in project /home/tommi/SDL2/2/SDL2-2.0.14/android-project

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :app:checkDebugAarMetadata
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:javaPreCompileDebug
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:mergeDebugResources

> Task :app:generateJsonModelDebug FAILED
/home/tommi/Android/Sdk/ndk/21.1.6352462/build/core/build-binary.mk:651: Android NDK: Module main depends on undefined modules: SDL2    
/home/tommi/Android/Sdk/ndk/21.1.6352462/build/core/build-binary.mk:664: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies.    .  Stop.
/home/tommi/Android/Sdk/ndk/21.1.6352462/build/core/build-binary.mk:651: Android NDK: Module main depends on undefined modules: SDL2    
/home/tommi/Android/Sdk/ndk/21.1.6352462/build/core/build-binary.mk:664: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies.    .  Stop.
/home/tommi/Android/Sdk/ndk/21.1.6352462/build/core/build-binary.mk:651: Android NDK: Module main depends on undefined modules: SDL2    
/home/tommi/Android/Sdk/ndk/21.1.6352462/build/core/build-binary.mk:664: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies.    .  Stop.
/home/tommi/Android/Sdk/ndk/21.1.6352462/build/core/build-binary.mk:651: Android NDK: Module main depends on undefined modules: SDL2    
/home/tommi/Android/Sdk/ndk/21.1.6352462/build/core/build-binary.mk:664: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies.    .  Stop.

> Task :app:processDebugManifestForPackage

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateJsonModelDebug'.
> executing external native build for ndkBuild /home/tommi/SDL2/2/SDL2-2.0.14/android-project/app/jni/Android.mk

What is the solution to this problem?

I tried also using CMake instead of ndkBuild, but it gives this error:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateJsonModelDebug'.
> /home/tommi/SDL2/2/SDL2-2.0.14/android-project/app/jni/CMakeLists.txt : C/C++ debug|arm64-v8a : CMake Error at /home/tommi/SDL2/2/SDL2-2.0.14/android-project/app/jni/CMakeLists.txt:11 (add_subdirectory):
    add_subdirectory given source "SDL" which is not an existing directory.

And indeed, there is no subdirectory called SDL. How am I supposed to proceed from here?