Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED] SFML android: "Specified Android API level does not match"  (Read 4387 times)

0 Members and 1 Guest are viewing this topic.

Millsialix

  • Guest
Hi,
this post is following this one, where I (unsuccessfully) tried to use SFML 2.5 for android. While waiting for a clear tutorial for SFML 2.5, I tried to compile SFML 2.4.2 for android this time, with the following command (run on windows 7 in SFML/build):
cmake -G"MinGW Makefiles" -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=14 ..
 

Output:

Code: [Select]
CMake Error at cmake/toolchains/android.toolchain.cmake:807 (message):
  Specified Android API level (14) does not match to the level found ().
  Probably your copy of NDK is broken.
Call Stack (most recent call first):
  build/CMakeFiles/3.9.1/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:40 (project)

I searched on google and nothing is really clear about that, all I can find is "you should add -DANDROID_NATIVE_API_LEVEL=14", but when I add this, it changes nothing. I also tried to manually change some parameters in the files cmake creates, or delete them to restart from scratch, ... It changes nothing
So, how can I make it works?
« Last Edit: August 01, 2018, 04:06:37 pm by Millsialix »

Millsialix

  • Guest
Nobody? I tried again a few times after this post but each time I have some errors, for example:

Code: [Select]
CMake Error at cmake/toolchains/android.toolchain.cmake:802 (message):
  Specified Android native API level 'android-9' is not supported by your
  NDK/toolchain.

// Note that I used the same command than my first post, with the -DANDROID_NATIVE_API_LEVEL

Or warnings, like:

Code: [Select]
CMake Warning at cmake/toolchains/android.toolchain.cmake:325 (message):
  Could not determine machine name for compiler from
  PATH_TO_MY_ANDROID_SDK/ndk-bundle/toolchains/mips64el-linux-and
roid-4.9/prebuilt/windows

I'm really stuck, so there's really no one who know where the problem is?

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
You're following outdated tutorial steps, plus the current master branch doesn't run properly on Android. Trying to get both sorted out as soon as possible.

Basic steps for building can be found in this pull request.

You should also make the change suggested in this issue and the changes from this PR.

Millsialix

  • Guest
Well, I followed your links and I'm back to the first error:

Code: [Select]
CMake Error at cmake/toolchains/android.toolchain.cmake:807 (message):
  Specified Android API level (14) does not match to the level found ().
  Probably your copy of NDK is broken.
Call Stack (most recent call first):
  build/CMakeFiles/3.9.1/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:48 (project)

In android.toolchain.cmake, line 807:

Code: [Select]
if( BUILD_WITH_ANDROID_NDK )
  __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL AND NOT __realApiLevel GREATER 9000 )
   message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
  endif()

So I looked in "${ANDROID_NDK}/platforms/android-14/arch-arm/usr/include/android/api-level.h" and I discover that there is no "include" folder in "android-14/arch-arm/usr". Is that normal? Because I can use Android Studio without problem (except the fact that this software is so slooooow ^^), so I wonder if there is really a problem with my ndk, and not in my command

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Delete your whole build directory and start over. Also don't use the toolchain file (I thought I deleted it).

Millsialix

  • Guest
I restarted without the android.toolchain.cmake, with the command:

cmake -G"MinGW Makefiles" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=%ANDROID_NDK% -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DANDROID_NATIVE_API_LEVEL=14 ..

I've had some errors but this post helped me. I built SFML 2.4.2 for android, it created some .so files in the build/lib folder. Now, I try to build the android sample with:

ndk-build APP_BUILD_SCRIPT="Android.mk" NDK_APPLICATION_MK="Application.mk" NDK_PROJECT_PATH=. NDK_MODULE_PATH="PATH_TO_MY_SFML/build"

(run in the folder "android/jni")
But I get the following error:

Code: [Select]
Android NDK: Android.mk: Cannot find module with tag 'sfml' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?

Android NDK: The following directories were searched:
Android NDK:
Android.mk:18: *** Android NDK: Aborting.    .  Stop.

It specify that it searches an empty directory name, but why?

EDIT : solved, I just forgot to do "mingw32-make -install"
« Last Edit: August 01, 2018, 04:05:40 pm by Millsialix »