I have a problem with call function from cocos2d-x (C++) to the Android Native (Java) in release mode.
In cocos2d-x, I have a function: logInToGamePlayServices, which will call a function in Java side start login to the Game Play Service. It's working normally in debug mode. But when I make a release build to upload to store, this function is not triggered.
My build Settings:
Compile Sdk Version : API 27: Android 8.1 (Oreo)
Target Sdk Version: API 27: Android 8.1 (Oreo)
Min Sdk Version: API 15: Android 4.0.3 (IceCreamSandwich)
Build Tool Version: 28.0.3
NDK: android-ndk-r16b
Cocos2d-x: v3.17
C++:
#include "platform/android/jni/JniHelper.h"
#include <jni.h>
USING_NS_CC;
void NativeHelper::logInToGamePlayServices() {
JniMethodInfo methodPlayGame;
if (JniHelper::getStaticMethodInfo(methodPlayGame, "games/core/CoreActivity", "logInToGamePlayServices", "()V")) {
methodPlayGame.env->CallStaticVoidMethod(methodPlayGame.classID, methodPlayGame.methodID);
}
}
Android Native:
package games.core;
public class CoreActivity extends Cocos2dxActivity {
public static void logInToGamePlayServices() {
_shareInstance.runOnUiThread(new Runnable() {
public void run() {
Intent signInIntent = _shareInstance.mGoogleSignInClient.getSignInIntent();
_shareInstance.startActivityForResult(signInIntent, RC_SIGN_IN);
}
});
}
}