I want to use c++ STL in android, but when I include STL (ex: hash_map), then run that occur error.
I use android studio 1.0.2 and android ndk r10d
This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.ndktest"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
ndk {
moduleName 'JNI'
stl 'stlport_shared'
}
}
productFlavors {
arm {
ndk {
abiFilters "armeabi", "armeabi-v7a"
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
Error Message:
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future. :app:preBuild :app:compileArmDebugNdk In file included from C:/Users/Sheng/Developer/android/SDK_Libs/android-ndk/sources/cxx-stl/stlport/stlport/stl/_algobase.h:46:0, from C:/Users/Sheng/Developer/android/SDK_Libs/android-ndk/sources/cxx-stl/stlport/stlport/stl/_vector.h:34, from C:/Users/Sheng/Developer/android/SDK_Libs/android-ndk/sources/cxx-stl/stlport/stlport/stl/_hashtable.h:34, from C:/Users/Sheng/Developer/android/SDK_Libs/android-ndk/sources/cxx-stl/stlport/stlport/stl/_hash_map.h:34, from C:/Users/Sheng/Developer/android/SDK_Libs/android-ndk/sources/cxx-stl/stlport/stlport/hash_map:38, from C:\Users\Sheng\tmp\NDKTEST\app\src\main\jni\maps.h:5, from C:\Users\Sheng\tmp\NDKTEST\app\src\main\jni\maps.cpp:1: C:/Users/Sheng/Developer/android/SDK_Libs/android-ndk/sources/cxx-stl/stlport/stlport/stl/_cstdlib.h: In function 'long int abs(long int)': C:/Users/Sheng/Developer/android/SDK_Libs/android-ndk/sources/cxx-stl/stlport/stlport/stl/_cstdlib.h:131:25: error: declaration of C function 'long int abs(long int)' conflicts with inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); } ^ more...
How can I solve? Thanks.