Jump to content
Keesver

Java type not registered

Recommended Posts

Hello,

 

I'm using class TLocalReceiver from a Kastri sample application. When I create a new instance from this class I run into an exception:

 

Project BroadCast.apk raised exception class EJNIFatal with message 'Java type com/delphiworlds/kastri/DWMultiBroadcastReceiverDelegate could not be found'.

In the source code I find this:

 [JavaSignature('com/delphiworlds/kastri/DWMultiBroadcastReceiverDelegate')]
  JDWMultiBroadcastReceiverDelegate = interface(IJavaInstance)
    ['{1AD78992-D81F-48A4-B341-F82B43094B67}']
    procedure onReceive(context: JContext; intent: JIntent); cdecl;
  end;

which tells me the type should have been be registered (I have this file included in the uses of my test application).

What am I missing here, do I have to add code to my application to register this class?

Share this post


Link to post
11 hours ago, Keesver said:

'm using class TLocalReceiver from a Kastri sample application. When I create a new instance from this class I run into an exception:

If you're using a demo app, you should not receive that error. The Java type comes from a java library from the Lib folder in Kastri, and which one will depend on the version of Delphi you are using.

  • Delphi 10.x:  dw-kastri-base.jar
  • Delphi 11.x: dw-kastri-base-2.0.0.jar
  • Delphi 12.x: dw-kastri-base-3.0.0.jar

The relevant jar file would have been added to the Libraries node of the Android 32-bit target in Project Manager, e.g (Delphi 12.x):

 

image.thumb.png.9361ceac0b49df0de6dacaa7c01f36ef.png

<snip>
image.thumb.png.519094f1cc9d20cfc18dad277b61b017.png

 

Which should be compiled in with the app, unless you're using Delphi 11.3, which requires a workaround.

 

Share this post


Link to post

I'm not using the demo app, I started a new project. I missed this step however, thanks for your info.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×