1

This is the code inside my .so file.

 RustGreetings g = new RustGreetings();
 String r ;
 try{
   **r = g.sayHello("world");**
   Log.d("tests","----------------"+r);
 } catch (Exception ex){
 Log.e("JNI","--------"+ex.getMessage());
 }

I want to call this function, that is available inside my precompiled .so file. But when I call this function it shows the error below:

Invalid argument(s): Failed to lookup symbol 'g.sayHello': undefined symbol: g.sayHello

This is my lookup function

typedef HelloWorld = Pointer<Utf8> Function();
typedef HelloWorldDart = Pointer<Utf8> Function();

  late HelloWorldDart _helloWorldDart;

 final device = Platform.isAndroid
        ? DynamicLibrary.open(libGreetings)
        : DynamicLibrary.process();


 _helloWorldDart =
        device.lookupFunction<HelloWorld, HelloWorldDart>('g.sayHello');
Robert Sandberg
  • 6,832
  • 2
  • 12
  • 30

0 Answers0