How to integrate plugin-x IAP in android

Hi,
I want to use in app billing in my android app, for doing this i tried to work with cocos2d-x/plugin-x, but i didn’t succeed to integrate it.

Could you please explain to me the steps for doing that correctly?

I followed this wiki , and i have this message:

Android NDK: /Users/yagoub/XXXX/XXXX/proj.android/../cocos2d/cocos/ui/Android.mk: Cannot find module with tag 'protocols/android' 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:         
make: Entering directory `/Users/yagoub/XXXXXX/XXXXXXXX/proj.android'
jni/Android.mk:47: *** Android NDK: Aborting.    .  Stop.
make: Leaving directory `/Users/yagoub/XXXXXX/XXXXXXXXXX/proj.android'
Error running command, return code: 2

No help :frowning:

I fixed the previous problem, but now i have another problem: The import org.cocos2dx.plugin cannot be resolved :frowning: .

Thank you, i fixed the last problem by linking the libPlugingProtocol in eclipse.

Sorry, the IAP integration is still work in progress.
The samples\HelloPlugin does run correctly, maybe you can take a look that it. I’ll adding more documentations in the future. :slight_smile:

Btw, Which IAP are you integrating with?

Thank you for your help, I want to integrate Google play IAP,But Does it work fine ?

It’s still work in progress, and has bugs, but it’s less buggy than the google’s implementation itself :smile:
Probably will be more stable by the end of Sep

Thank you it worked fine with me. and if you could add sample for iOS IAP , i will be very happy :slight_smile:

Hi Yagoub,

Im trying to integrate the Google Billing for Android as well.
I had the same problems as u have. Could u share with me what are your solutions.
I using cocos2d-x 3.0 version.
Thanks in advance.

Check your Android.mk if it’s like this

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external)

$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos/base)
$(call import-add-path,$(LOCAL_PATH)/../../cocos2d/plugin/publish)
LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                      /* list all your cpp files */ 


LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static \
PluginProtocolStatic
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
include $(BUILD_SHARED_LIBRARY)

$(call import-module,2d)
$(call import-module,audio/android)
$(call import-module,extensions)
$(call import-module,editor-support/cocostudio)

$(call import-module,protocols/android)

I’m having problems with the Google Play IAP jar. It seems like it is not compiled. I follow the method to create the plugins listed in the wiki. It does not have an option to allow me to compile Android Goggle Play IAP billing library. Are you able to get it to work?

When i attempt to include the project in eclipse, the project has some problems.