You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not a maintainer or contributor, but I've been working with this library a bit lately. Here's a simple gist which shows how to register a static native method to a java class method. For strings, the methods you want to know are:
The high-level API is all about the tags, which are defined in the public const char* method Name(). All that makes jni::String special is literally this:
In the high level API, jni::Class, jni::Object, and jni::Field are generally passed by reference, and are wrapped in Local<> or Global<> ownership types which both derive from jni::Unique. They cannot be copy-constructed, and need to be constructed via one of the static methods (jni::Class::Find( env ) for example) or with jni::NewLocal or jni::NewGlobal. The deleted constructor error occurs when you try to directly create jni::Object, while you should be creating a reference to that object.
Start with the Readme, then look at examples/native_peer.cpp. This should help you get started. The NativePeer example is an invaluable use case, it solves and neatly hides pointer to member function registration. Finally, I found the most help in test/high_level.cpp - this lays out all the syntax you need for almost everything.
As in
Due to various incarnations of
deleted constructor of jni::Object<jni::StringTag>
I don't know how to make it compile.The text was updated successfully, but these errors were encountered: