Jump to content
KimHJ

Android aidl error when using it.

Recommended Posts

I create a JavaInterface file using java2op, but I have problems when I use it. I have attached the JavaInterface.pas

I get this error when it execute printText.

First chance exception at $8689BB93. Exception class EJNIFatal with message 'Java type recieptservice/com/recieptservice/PrinterInterface could not be found'. Process ComcaH10.apk (6409)

 

What is missing?

 

Tanks for any help.

 

uses
JavaInterfaces;

procedure TMainForm.PrintThis;
 var
 Myprinter: JPrinterInterface;
 begin

      MyPrinter := TJPrinterInterface.Create;

      MyPrinter.printText(StringToJString('This Is A Test'));
      MyPrinter.endWork;

 end;

 

JavaInterfaces.pas

Share this post


Link to post
1 minute ago, KimHJ said:

Exception class EJNIFatal with message 'Java type recieptservice/com/recieptservice/PrinterInterface could not be found'

That usually means you have not added the required .jar file (the one you ran Java2OP on) to the project. In Project Manager:

  1. Expand the Android 32-bit target
  2. Right-click on Libraries
  3. Click Add..
  4. Select the .jar file
  5. Click OK

Note that the .jar will be compiled in regardless of whether you compile for 32-bit or 64-bit.

Share this post


Link to post

You are right, I didn't know I had to include the jar file.

 

I have a aidl and a jar, I made the JavaInterface.pas from the aidl, do I need to add that as well?

 

Thanks.

Edited by KimHJ

Share this post


Link to post

I added the jar file, I did not see anything about adding the aidl in Embarcadero's website about jar files.

Now I get an exception class 6 in Andoidapi.JNIBridge in class procedure TBridgeHelper.Alloc

Could this be because I used the aidl file to create the JavaInterfaces.pas?

Share this post


Link to post
1 hour ago, KimHJ said:

I did not see anything about adding the aidl in Embarcadero's website about jar files.

That's because you don't need to.

1 hour ago, KimHJ said:

Could this be because I used the aidl file to create the JavaInterfaces.pas?

Possibly - the Java signatures in that file look a bit odd. Is the .jar file available publicly?

Share this post


Link to post

Yes, I will create a new java2op using the jar.

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

×