Android C ++ Realtime client compatibility with NDK r18.

Hello,

This is for the Android C ++ Realtime client. I am using Android Studio and Photon-AndroidNDK-Sdk_v4-1-11-2. I upgraded my NDK to r18 and got the following errors:

*** Android NDK: APP_STL gnustl_static is no longer supported. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information. . Stop.


The release notes for NDK r18
“gnustl, gabi++, and stlport have been removed.”

For my project I don’t care about what version of NDK i use just as long I get photon to work. So, I downgraded to r17 and my project is ok.

I just wanted to let photon know that I don’t think Photon-AndroidNDK-Sdk_v4-1-11-2
is compatible with NDK r18.

Thanks,

Comments

  • Hi @GreenRollingHills.

    The Photon SDK for Android NDK supports both, gnustl_static (libstdc++) and c++_static (libc++). The build variants of the prebuilt libs that have a "_lib_c++" in their filenames have been built against c++_static, while the ones that do not contain "_lib_c++" in their filenames have been built against gnustl_static.

    You simply need to make sure that your app links against the "_lib_c++" variants of the libs when it uses c++_static itself.
  • Hello,

    So, I configured my Android Studio project to use NDK r18.1.5063045. I also changed my Application.mk to :

    APP_ABI := all
    APP_STL := c++_static
    APP_CPPFLAGS := -std=c++11

    But I am getting errors like the following:

    D :/android-ndk/build//../sources/cxx-stl/gnu-libstdc++/4.9/include/iostream:74: error: undefined reference to 'std::ios_base::Init::Init()'

    jni/../src/AuthenticationValues.cpp:175: error: undefined reference to 'std::ios_base::Init::~Init()'
  • Hi @GreenRollingHills .

    As I have explained in my previous post, you need to make sure that your app links against the "_lib_c++" variants of the libs when it uses c++_static itself.
  • Hello,

    I am unsure how to link to the "_lib_c++" variants. Is there something else I have to change other than changing the APP_STL variable in Application.mk to c++_static?
  • Hi @GreenRollingHills.

    In ./Common-cpp/lib/common-cpp-prebuilt/Android.mk please change
    LOCAL_SRC_FILES := libcommon-cpp-static_${APP_OPTIM}_android_$(TARGET_ARCH_ABI).a
    into
    LOCAL_SRC_FILES := libcommon-cpp-static_${APP_OPTIM}_android_$(TARGET_ARCH_ABI)_libc++.a

    Do the same for Photon-cpp and LoadBalancing-cpp as well.
  • Hello,

    I got it to work. Thanks.
Sign In or Register to comment.