Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17078

Calling java functions from c++ using JNI

$
0
0

@atin_agarwal2 wrote:

I'm trying to migrate to cocos2d-x version 3.12 from ver 3.4 but my app crashes when I try to call java methods from c++ code using JNI. It used to work earlier in 3.4 version but since they have changed the implementation for it.
Here's my code:

java:

public static String guid()
{
UUID uuid = UUID.randomUUID();
String randomUUIDString = uuid.toString();
return randomUUIDString;
}

C++:
string PlatformInterop::createGuid()
{
const std::string classPath = "com/cpyname/android/common/Utilities";
std::string guid = JniHelper::callStaticStringMethod(classPath, "guid");
return guid;
}

Please help me out

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17078


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>