IAP compile error for android

Hi,
I install sdkbox for IAP correctly, then run build_native.py on terminal.
But I get following compile error.

Android NDK: WARNING:/Work/My_Project/proj.android/…/cocos2d/plugin/protocols/proj.android/jni/Android.mk:PluginProtocolStatic: LOCAL_LDLIBS is always ignored for static libraries
make: Entering directory /Work/My_Project/proj.android' [armeabi] StaticLibrary : libcocosbuilder.a [armeabi] StaticLibrary : libcocos3d.a [armeabi] StaticLibrary : libspine.a [armeabi] StaticLibrary : libaudioengine.a [armeabi] StaticLibrary : libui.a [armeabi] StaticLibrary : flatbuffers.a [armeabi] StaticLibrary : libextension.a [armeabi] StaticLibrary : libcocos2dxinternal.a [armeabi] StaticLibrary : libbox2d.a [armeabi] StaticLibrary : libcocos2d.a [armeabi] StaticLibrary : libPluginProtocolStatic.a [armeabi] StaticLibrary : libcocostudio.a [armeabi] StaticLibrary : libnetwork.a [armeabi] StaticLibrary : libandroid_native_app_glue.a [armeabi] StaticLibrary : libcocosdenshion.a [armeabi] StaticLibrary : libcocos2dandroid.a [armeabi] StaticLibrary : libcpufeatures.a [armeabi] Gdbserver : [arm-linux-androideabi-4.8] libs/armeabi/gdbserver [armeabi] Gdbsetup : libs/armeabi/gdb.setup [armeabi] SharedLibrary : libcocos2dcpp.so /DevelopTools/Cocos2dx-android-tools/Android_Tools/android-ndk-r9d/sources/android/native_app_glue/android_native_app_glue.c:232: error: undefined reference to 'android_main' collect2: error: ld returned 1 exit status make: *** [obj/local/armeabi/libcocos2dcpp.so] Error 1 make: Leaving directory/Work/My_Project/proj.android’
Ndk build failed!
Traceback (most recent call last):
File “build_native.py”, line 43, in
build(opts.build_mode)
File “build_native.py”, line 28, in build
raise Exception(“Build dynamic library for project [ " + app_android_root + " ] fails!”)
Exception: Build dynamic library for project [ /Work/My_Project/proj.android/…/ ] fails!

I’m using cocos2d-x 3.6 and plugin-x for Facebook , too.
Any solution ?

Thanks.

I get issue such as that, too.
I have not the solving.

Can you tell me what version of cocos2d-x are you using?

Can you remove the following from Android.mk and try again?
android_native_app_glue

I use cocos2d-x 3.6 and ndk r9d.
And I’m using Plugin_X for Facebook and admob.
When I remove “android_native_app_glue” from Android.mk, project is compiled without error.
But I get following error when I run app.

DalvikVM [localhost:8607]	
	Thread [<1> main] (Suspended (exception NullPointerException))	
		<VM does not provide monitor information>	
		IabHelper.startSetup(IabHelper$OnIabSetupFinishedListener) line: 267	
		SDKBoxIAPGooglePlay.initWithKey(String) line: 257	
		SDKBoxIAPGooglePlay$1.run() line: 96	
		Handler.handleCallback(Message) line: 615	
		Handler.dispatchMessage(Message) line: 92	
		Looper.loop() line: 153	
		ActivityThread.main(String[]) line: 5022	
		Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]	
		Method.invoke(Object, Object...) line: 511	
		ZygoteInit$MethodAndArgsCaller.run() line: 1032	
		ZygoteInit.main(String[]) line: 790	
		NativeStart.main(String[]) line: not available [native method]	
	Thread [<10> Binder_2] (Running)	
	Thread [<9> Binder_1] (Running)	
	Thread [<11> SoundPool] (Running)	
	Thread [<12> SoundPoolThread] (Running)	
	Thread [<13> GLThread 1514] (Running)	
	Thread [<14> pool-1-thread-1] (Running)	
	Thread [<15> pool-1-thread-2] (Running)	
	Thread [<16> pool-1-thread-3] (Running)	
	Thread [<17> Binder_3] (Running)

Did you put the proper info in sdkbox_config.json

Yes, I put correct info in sdkbox_config.json.

Do run IAP feature correctly without android_native_app_glue in android.mk ?

It’s crashed in phones without google play service.
So I think you should implement exception for such case in SDKBOX IAP jar.

Let me ask @nite to review this. I am not sure what is required on the actual phone for IAP.

Yes, that’s a bug

Hi,
When can you fix it ?

We should be able to fix it in 1.2.1 release, which is scheduled for 7/30

Hi,

IAP feature run well now.

Thanks

@tianxinxing can you explain how you resolved this issue?.Because I am also facing same issue.

I think if you use the latest v1.3.0 this issue is resolved.