0

I've been stuck for two days trying to compile a simple .so library in CPP for a project I'm working on. For some reason the NDK gives me this result no matter what I try:

fatal error: random: No such file or directory #include <random>

Application.mk

APP_ABI := armeabi armeabi-v7a x86
NDK_TOOLCHAIN_VERSION := clang
APP_STL := gnustl_static
APP_PLATFORM := android-14

Android.mk

APP_ABI := armeabi armeabi-v7a x86
NDK_TOOLCHAIN_VERSION := 4.9
APP_CPPFLAGS := --std=c++11 
APP_STL := gnustl_static
APP_PLATFORM := android-14

And the command I build with (I don't use jni or an Android Project)

ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=./Android.mk
Sagie Levy
  • 357
  • 3
  • 12
  • The `APP_`-flags should go into your `Application.mk` (i.e. not in `Android.mk`). Try explicitly pointing `ndk-build` to your `Application.mk` by adding `NDK_APPLICATION_MK=/path/to/your/Application.mk` to the command line. – Michael Jul 25 '16 at 10:21

1 Answers1

0

While I didn't quite get to solve this problem I managed to bypass it by creating an empty Android project with Android Studio, adding a /jni directory to place all cpp my code in and copying a build.gradle script from a Google jni sample. I Hope that helps

Sagie Levy
  • 357
  • 3
  • 12