Recent

Author Topic: LAMW with jar libraries  (Read 10928 times)

Robert Gilland

  • Full Member
  • ***
  • Posts: 159
LAMW with jar libraries
« on: March 25, 2019, 10:48:17 pm »
I used Tools -> LAMW -> Use Import Java Stuff.

All it did was move files from my Third Party java Library to my Project directory.

I was expecting it to convert the java files to pas files.

So I could use them in my LAMW application.

No Idea how to actually use these files in my project.

I have a Bar code scanner jar library. I need to access.

None of the demos or example projects seem to help.

I would upload the jar library but it is too big.


jmpessoa

  • Hero Member
  • *****
  • Posts: 1943
Re: LAMW with jar libraries
« Reply #1 on: March 25, 2019, 11:02:05 pm »

You can try the demo "AppIntentDemoZXing1"

But we can implement a pascal interface to your jar library.
Upload  a simple java demo to some "online open drive"....

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Robert Gilland

  • Full Member
  • ***
  • Posts: 159
Re: LAMW with jar libraries
« Reply #2 on: March 26, 2019, 11:37:35 pm »
Have sent a link to jmpessoa via private message, this includes a small test java app and the SDK of the Third Party vendor. Am looking at the AppIntentDemoZXing1 app.

Robert Gilland

  • Full Member
  • ***
  • Posts: 159
Re: LAMW with jar libraries
« Reply #3 on: March 27, 2019, 07:23:43 am »
Can't get appintentdemozxing1 working it crashes


adb logs from appintentdemozxing1 are below:



I/BufferQueue(  132): [Starting com.example.appintentdemozxing1](this:0x4189e730,api:2) disconnect: api=2
I/SurfaceTexture(  132): [Starting com.example.appintentdemozxing1] [virtual android::status_t android::SurfaceTexture::forceAuxConversionLocked()] mCurrentTexture:0, mCurrentBuf:0x41b6ef38
I/BufferQueue(  132): [Starting com.example.appintentdemozxing1](this:0x4189e730,api:0) getReleasedBuffers: returning mask 0xffffffff
I/SurfaceTexture(  132): [Starting com.example.appintentdemozxing1](this:0x419ac628,api:0) destroying EGLImage dpy=0x1 img=0x10000008
D/KeyguardViewMediator(  548): setHidden false
D/KeyguardUpdateMonitor(  548): sendKeyguardVisibilityChanged(true)
D/AudioFlinger(  137): stop(4097), calling pid 548
D/AudioFlinger(  137): not stopping/stopped => stopping/stopped (4097) on thread 0x41be5460
D/AudioMTKPolicyManager(  137): stopOutput() output 2, stream 1, session 466
D/AudioMTKPolicyManager(  137): getNewDevice() selected device 0 output= 2
D/AudioMTKPolicyManager(  137): setOutputDevice() output 2 device 0000 delayMs 184
D/AudioMTKPolicyManager(  137): checkDeviceMuteStrategies outputDesc = 0x419c69b0 prevDevice = 2 delayMs = 184
D/AudioMTKPolicyManager(  137): setOutputDevice() setting same device 0000 or null device for output 2
D/KeyguardUpdateMonitor(  548): handleKeyguardVisibilityChanged(1)
D/AudioTrack(  548): audiotrack 0x5694b6a0 stop done
D/KeyguardViewMediator(  548): handleMessage enter msg name=SET_HIDDEN
D/KeyguardViewMediator(  548): handleMessage exit msg name=SET_HIDDEN
I/BufferQueue(  132): [Starting com.example.appintentdemozxing1](this:0x4189e730,api:0) consumerDisconnect
I/BufferQueue(  132): [Starting com.example.appintentdemozxing1](this:0x4189e730,api:0) ~BufferQueue
D/AudioFlinger(  137): track 4097 u=00001000, s=00001000 [NOT READY] on thread 0x41be5460
D/AudioFlinger(  137): presentationComplete() reset: mPresentationCompleteFrames 9177 audioHalFrames 4057
D/AudioFlinger(  137): track 4097 u=00001000, s=00001000 [NOT READY] on thread 0x41be5460
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/AudioFlinger(  137): track 4097 u=00001000, s=00001000 [NOT READY] on thread 0x41be5460
D/AudioFlinger(  137): track 4097 u=00001000, s=00001000 [NOT READY] on thread 0x41be5460
D/AudioFlinger(  137): presentationComplete() session 466 complete: framesWritten 9216
D/AudioFlinger(  137): TrackBase::reset
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/KeyguardViewMediator(  548): setHidden false
D/KeyguardUpdateMonitor(  548): sendKeyguardVisibilityChanged(true)
D/KeyguardUpdateMonitor(  548): handleKeyguardVisibilityChanged(1)
D/KeyguardViewMediator(  548): handleMessage enter msg name=SET_HIDDEN
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw
D/AudioMTKStreamOut(  137): write(), buffer = 0x41be5728 bytes = 4096 mLatency = 92
D/KeyguardViewMediator(  548): handleMessage exit msg name=SET_HIDDEN
I/BufferQueue(  132): [Application Error: com.example.appintentdemozxing1](this:0x41b66d60,api:2) disconnect: api=2
I/SurfaceTexture(  132): [Application Error: com.example.appintentdemozxing1] [virtual android::status_t android::SurfaceTexture::forceAuxConversionLocked()] mCurrentTexture:2, mCurrentBuf:0x414a6f40
I/BufferQueue(  132): [Application Error: com.example.appintentdemozxing1](this:0x41b66d60,api:0) getReleasedBuffers: returning mask 0xffffffff
I/SurfaceTexture(  132): [Application Error: com.example.appintentdemozxing1](this:0x41b6e2f0,api:0) destroying EGLImage dpy=0x1 img=0x10000004
I/SurfaceTexture(  132): [Application Error: com.example.appintentdemozxing1](this:0x41b6e2f0,api:0) destroying EGLImage dpy=0x1 img=0x1000000b
I/SurfaceTexture(  132): [Application Error: com.example.appintentdemozxing1](this:0x41b6e2f0,api:0) destroying EGLImage dpy=0x1 img=0x1000000c
D/KeyguardViewMediator(  548): setHidden false
D/KeyguardUpdateMonitor(  548): sendKeyguardVisibilityChanged(true)
D/KeyguardUpdateMonitor(  548): handleKeyguardVisibilityChanged(1)
D/KeyguardViewMediator(  548): handleMessage enter msg name=SET_HIDDEN
D/KeyguardViewMediator(  548): handleMessage exit msg name=SET_HIDDEN
I/BufferQueue(  132): [Application Error: com.example.appintentdemozxing1](this:0x41b66d60,api:0) consumerDisconnect
I/BufferQueue(  132): [Application Error: com.example.appintentdemozxing1](this:0x41b66d60,api:0) ~BufferQueue
D/AudioFlinger(  137): threadLoop_sleepTime write muted data to hw

jmpessoa

  • Hero Member
  • *****
  • Posts: 1943
Re: LAMW with jar libraries
« Reply #4 on: March 27, 2019, 09:12:42 pm »

demo "AppIntentDemoZXing1"  updated!

Added runtime permission!  [need for Android >= 6.0]

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Robert Gilland

  • Full Member
  • ***
  • Posts: 159
Re: LAMW with jar libraries
« Reply #5 on: March 28, 2019, 02:28:12 am »
Thanks got the latest rebuilt Lazarus with them and voila errors:

D:\laztoapk\downloads\laz4android2.0.0\config\onlinepackagemanager\packages\LAMW\demos\GUI\AppIntentDemoZXing1\jni\controls.lpr(220,3) Error: (5000) Identifier not found "Java_Event_pOnDown"
D:\laztoapk\downloads\laz4android2.0.0\config\onlinepackagemanager\packages\LAMW\demos\GUI\AppIntentDemoZXing1\jni\controls.lpr(247,3) Error: (5000) Identifier not found "Java_Event_pOnDoubleClick"

jmpessoa

  • Hero Member
  • *****
  • Posts: 1943
Re: LAMW with jar libraries
« Reply #6 on: March 28, 2019, 04:24:08 am »
Maybe, there is some delay in "onlinepackagemanager" ....

What about direct update from github?

[this events/Identifiers  are in "Laz_And_Controls.pas"]
« Last Edit: March 28, 2019, 04:28:38 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Robert Gilland

  • Full Member
  • ***
  • Posts: 159
Re: LAMW with jar libraries
« Reply #7 on: March 28, 2019, 04:45:34 am »
I got the code directly from directly from GIT and then I exported it into lazarus because onlinepackagemanager does not reflect what is in GIT.

jmpessoa

  • Hero Member
  • *****
  • Posts: 1943
Re: LAMW with jar libraries
« Reply #8 on: March 28, 2019, 07:08:09 am »

Ok.

Then you need to re-install [leastwise] the "tfpandroidbridge_pack.lpk"

[remember: to re-install a LAMW package we need a system default project open in Lazarus....
not a LAMW cross-compile project...]

Now, Re-open your project then "Run-->"Clean up and Build..."

Quote
just a  side note:
I am implementing a new "ZBAR" barcode custom component from here:
http://sourceforge.net/projects/zbar/files/AndroidSDK/

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Robert Gilland

  • Full Member
  • ***
  • Posts: 159
Re: LAMW with jar libraries
« Reply #9 on: March 28, 2019, 07:41:41 am »
Thank you! that worked.

Does that ZBar component implement the attached aidl files  from http://www.zkc-pda.com?



Robert Gilland

  • Full Member
  • ***
  • Posts: 159
Re: LAMW with jar libraries
« Reply #10 on: March 28, 2019, 08:02:06 am »
I reckon we are close to getting this zxing1 app working, but still another hurdle ( Using Android - 17 Jelly bean ):

E/AndroidRuntime(14054): FATAL EXCEPTION: main
E/AndroidRuntime(14054): java.lang.UnsatisfiedLinkError: Native method not found: com.example.appintentdemozxing1.Controls.pAppOnScreenStyle:()I
E/AndroidRuntime(14054):        at com.example.appintentdemozxing1.Controls.pAppOnScreenStyle(Native Method)
E/AndroidRuntime(14054):        at com.example.appintentdemozxing1.Controls.jAppOnScreenStyle(Controls.java:1479)
E/AndroidRuntime(14054):        at com.example.appintentdemozxing1.App.onCreate(App.java:60)
E/AndroidRuntime(14054):        at android.app.Activity.performCreate(Activity.java:5122)
E/AndroidRuntime(14054):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1084)
E/AndroidRuntime(14054):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
E/AndroidRuntime(14054):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
E/AndroidRuntime(14054):        at android.app.ActivityThread.access$600(ActivityThread.java:162)
E/AndroidRuntime(14054):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
E/AndroidRuntime(14054):        at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(14054):        at android.os.Looper.loop(Looper.java:194)
E/AndroidRuntime(14054):        at android.app.ActivityThread.main(ActivityThread.java:5371)
E/AndroidRuntime(14054):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(14054):        at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(14054):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
E/AndroidRuntime(14054):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
E/AndroidRuntime(14054):        at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  548):   Force finishing activity com.example.appintentdemozxing1/.App

Robert Gilland

  • Full Member
  • ***
  • Posts: 159
Re: LAMW with jar libraries
« Reply #11 on: March 29, 2019, 01:53:45 am »
Finally got the ZXing app ( downloaded the latest ndk ), working however as expected the Barcode Scanner App did not work as expected, as it is built for a different barcode scanner the the machine I have.

jmpessoa

  • Hero Member
  • *****
  • Posts: 1943
Re: LAMW with jar libraries
« Reply #12 on: March 29, 2019, 04:24:59 am »

You can try:

New! jZBarcodeScannerView component

New! AppZBarcodeScannerViewDemo1

Thank you!!!

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Robert Gilland

  • Full Member
  • ***
  • Posts: 159
Re: LAMW with jar libraries
« Reply #13 on: March 29, 2019, 04:55:30 am »
Thank you however juploadservice_icon.lrs is missing from ..\LAMW\android_bridges

jmpessoa

  • Hero Member
  • *****
  • Posts: 1943
Re: LAMW with jar libraries
« Reply #14 on: March 29, 2019, 05:05:03 am »

Fixed!!!

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018