0

I have 2 JAR files coming from an SDK that I have to use.

Generation problem

I succeeded in generating the first .pas file, but Java2OP fails to generate the second .pas I need, with the message

Access violation at address 0042AF4A dans the 'Java2OP.exe' module. Read at address 09D00000

Would this come from a common issue? There's no other hints about what causes the problem in the SDK .jar.

I'm using Java2OP located in C:\Program Files (x86)\Embarcadero\Studio\18.0\bin\converters\java2op, but I had to first use the solutions in Delphi 10.1 Berlin - Java2OP: class or interface expected before generating the 1st file.

Compilation problem

Anyway, I tried to generate a .hpp file from the generated .pas.

I don't know much about Delphi. Does the problem come from the SDK itself, or the generation of the .pas file?


1st issue solved

Java2OP included Androidapi.JNI.Java.Util and not Androidapi.JNI.JavaUtil. I had to import Androidapi.JNI.JavaUtil myself, though it is present in the /Program Files(x86)/Embarcadero/... folders.

2nd issue

The same 4 compilation errors happen multiple times across the .pas file on parts using the word this.

Do I have to replace every use of this with self?

Errors

E2023 The function require a type of result : Line 4
E2147 The property 'this' doesn't exist in the base class : Line 5
E2029 ',' or ':' awaited but found 'read' identificator : Line 5
E2029 ',' or ':' awaited but found number : Line 5
[JavaSignature('com/hsm/barcode/DecoderConfigValues$SymbologyFlags')]
JDecoderConfigValues_SymbologyFlags = interface(JObject)
  ['{BCF30FD2-B650-433C-8A4E-8B638A508487}']
  function _Getthis$0: JDecoderConfigValues; cdecl;
  property this$0: JDecoderConfigValues read _Getthis$0;
end;

[JavaSignature('com/hsm/barcode/ExposureValues$ExposureSettingsMinMax')]
JExposureValues_ExposureSettingsMinMax = interface(JObject)
  ['{A576F85F-A021-475C-9741-06D92DBC205F}']
  function _Getthis$0: JExposureValues; cdecl;
  property this$0: JExposureValues read _Getthis$0;
end;
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
IDS
  • 79
  • 10
  • It might help to provide links to the .jar files – Dave Nottage Mar 28 '18 at 21:30
  • @DaveNottage Here it is, the one succeeding the .pas generation is `cw-deviceapi(20180201).jar` the other one is `IGLBarDecoder.jar` https://ufile.io/wkt0p – IDS Mar 29 '18 at 07:30
  • I modified a bit the .pas generated by removing hte `$0` and suceeded to generate the .hpp. Even then when importing the right .jar in the project manager, C++Builder fail to dex the .jar with the error : ` The command "PATH ...\jdk1.7.0_21\bin ... & "...\AndroidSDK-24.3.3_GIB.Build.22858.6822\build-tools\22.0.1\dx.bat" --dex --output="...\Debug\classes.dex" ... "...\MCA5.Api-dexed.jar"" stoppped with char 2 ` I tried to change to SDK 26.1.1 but I was still getting this error – IDS Mar 29 '18 at 08:39
  • The devices on which this SDK is used are Androids 6.0 (API Level 23). – IDS Mar 29 '18 at 08:45
  • As far as I can tell, you shouldn't need this$0 and _Getthis$0, i.e. you could leave them out. Not sure why the other one is causing an AV – Dave Nottage Mar 29 '18 at 08:58
  • @DaveNottage Ok I got more info by running the command myself, the error is : `UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/zebra/adc/decoder/B arCodeReader$DecodeCallback; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:608) at ....` which leads me to this question https://stackoverflow.com/questions/34393706/how-to-resolve-multiple-dex-files-error-in-android-studio?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa I'm currently searching how to do this with C++Builder – IDS Mar 29 '18 at 15:27
  • I seriously wish C++Builder was more talkative instead of throwing me code numbers. – IDS Mar 29 '18 at 15:31
  • Sounds like an issue you need to [report to Embarcadero](http://quality.embarcadero.com). – Remy Lebeau Mar 29 '18 at 23:09

0 Answers0