Hi!
I’ve been trying to integrate the IAP plugin in cocos2dx in android with no success. iOS works like a charm of course, like always.
Details:
- cocos2d-x 3.10
- SDKBOX version 1.0.0.13
- Trying to compile for android studio
- NDK r10e
Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
$(call import-add-path,$(LOCAL_PATH))
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos)
LOCAL_MODULE := cocos2dcpp_shared
LOCAL_MODULE_FILENAME := libcocos2dcpp
LOCAL_SRC_FILES := hellocpp/main.cpp \
...
LOCAL_CPPFLAGS := -DSDKBOX_ENABLED
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes \
...
# _COCOS_HEADER_ANDROID_BEGIN
# _COCOS_HEADER_ANDROID_END
LOCAL_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES := PluginIAP sdkbox
# _COCOS_LIB_ANDROID_BEGIN
# _COCOS_LIB_ANDROID_END
include $(BUILD_SHARED_LIBRARY)
$(call import-module, ./ sdkbox)
$(call import-module, ./pluginiap)
$(call import-module,.)
# _COCOS_LIB_IMPORT_ANDROID_BEGIN
# _COCOS_LIB_IMPORT_ANDROID_END
Application.mk:
APP_STL := c++_shared
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
APP_LDFLAGS := -latomic
APP_PLATFORM := android-16
ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_OPTIM := release
endif
When I compile, I get this error
jni/../../../Classes/IAP/IAPHelper.cpp:55: error: undefined reference to 'sdkbox::IAP::purchase(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
jni/src/IAPProxy.cpp:49: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
jni/src/IAPProxy.cpp:47: error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/stl_pair.h:96: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
jni/../../../../csc/protocols/share/json98.h:112: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/usr/local/Cellar/android-ndk/r10e/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/stl_pair.h:96: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
jni/src/IAPProxy.cpp:25: error: undefined reference to 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
And so on and so forth…
Please help, this is very frustrating.
Thanks for your help