LAMW with jar libraries lazarus / 43-Android ---------------------------------------------------------------------- Robert Gilland · 2019-03-25 21:48 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 · 2019-03-25 22:02 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".... ---------------------------------------------------------------------- Robert Gilland · 2019-03-26 22:37 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 · 2019-03-27 06:23 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/KeyguardUpda]"]>Blockednitor(  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/KeyguardUpda]"]>Blockednitor(  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/KeyguardUpda]"]>Blockednitor(  548): sendKeyguardVisibilityChanged(true) D/KeyguardUpda]"]>Blockednitor(  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/KeyguardUpda]"]>Blockednitor(  548): sendKeyguardVisibilityChanged(true) D/KeyguardUpda]"]>Blockednitor(  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 · 2019-03-27 20:12 demo "AppIntentDemoZXing1"  updated! Added runtime permission!  [need for Android >= 6.0] Thank you! ---------------------------------------------------------------------- Robert Gilland · 2019-03-28 01:28 Thanks got the latest rebuilt Lazarus with them and voila errors: D:\laztoapk\downloads\laz4android2.0.0\config\onlinepackagemanager\pac kages\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\pac kages\LAMW\demos\GUI\AppIntentDemoZXing1\jni\controls.lpr(247,3) Error: (5000) Identifier not found "Java_Event_pOnDoubleClick" ---------------------------------------------------------------------- jmpessoa · 2019-03-28 03:24 Maybe, there is some delay in "onlinepackagemanager" .... What about direct update from github? [this events/Identifiers  are in "Laz_And_Controls.pas"] ---------------------------------------------------------------------- Robert Gilland · 2019-03-28 03:45 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 · 2019-03-28 06:08 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..." Quotejust a  side note: I am implementing a new "ZBAR" barcode custom component from here: http://sourceforge.net/projects/zbar/files/AndroidSDK/ ---------------------------------------------------------------------- Robert Gilland · 2019-03-28 06:41 Thank you! that worked. Does that ZBar component implement the attached aidl files  from http://www.zkc-pda.com? ---------------------------------------------------------------------- Robert Gilland · 2019-03-28 07:02 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.Con trols.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.callAct ivityOnCreate(Instrumentation.java:1084) E/AndroidRuntime(14054):        at android.app.ActivityThread.performL aunchActivity(ActivityThread.java:2307) E/AndroidRuntime(14054):        at android.app.ActivityThread.handleLa unchActivity(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 · 2019-03-29 00:53 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 · 2019-03-29 03:24 You can try: New! jZBarcodeScannerView component New! AppZBarcodeScannerViewDemo1 Thank you!!! ---------------------------------------------------------------------- Robert Gilland · 2019-03-29 03:55 Thank you however juploadservice_icon.lrs is missing from ..\LAMW\android_bridges ---------------------------------------------------------------------- jmpessoa · 2019-03-29 04:05 Fixed!!! Thank you! ---------------------------------------------------------------------- Robert Gilland · 2019-04-01 05:32 Was able to get the PDA working using the BroadcastRecevierDemo2 as basis. Have attached working LAMW code ---------------------------------------------------------------------- las · 2019-04-03 13:42 Hi! First, i'm want to say thanks for excellent LAMW. I readed all google and forum. But can't searched, how to use 3rd party jar library in LAMW project. Can i self add it to project, or not?  I copy it to libs. Lazarus add it to .apk, but FindClass don't find class from .jar Please, help me. What i'm do wrong? Sorry for my English... ---------------------------------------------------------------------- jmpessoa · 2019-04-03 16:17 Hi,  what jar lib you need? ---------------------------------------------------------------------- las · 2019-04-03 19:23 Specialized library for working with banking equipment for payment cards. The Bank gave me an example application for Android Studio. Everything is compiled in Android Studio. But for many years I write only on Lazarus for Windows and Linux. Moving to Java is not fast, but the project should be . It would be very good to be able to connect any Java library on your own. So, as it is done for example with the connection of dll in Lazarus when creating applications for Windows. ---------------------------------------------------------------------- jmpessoa · 2019-04-04 16:11 QuoteMoving to Java is not fast, but the project should be... Ok! I will help you!!! ---------------------------------------------------------------------- las · 2019-04-04 16:18 How can you help me? Ideally, I would like to get some instructions on a simple example of how to connect the jar to Lazarus. I think this question is very interesting for many people. ---------------------------------------------------------------------- jmpessoa · 2019-04-04 16:21 Yes! I will write some instructions/tutorial! ---------------------------------------------------------------------- Robert Gilland · 2019-04-04 21:46 Yes very, interesting for me as well, I was able to solve my problems without using jar libraries, next time I might not be so lucky. ---------------------------------------------------------------------- schumi · 2021-07-13 10:30 Hi, I'm interested to connect jar SDK library in a lamw app to control android rugged device. There is some tutorial? thank you ---------------------------------------------------------------------- jmpessoa · 2021-07-13 17:58 QuoteI'm interested to connect jar SDK library ... The ease path is to try mimic a [very simple]  Java/Android example using this jar library... Do you have one? ---------------------------------------------------------------------- schumi · 2021-07-14 06:50 I want try to integrate Datalogic Android SDK https://datalogic.github.io/ with tools --> [LAMW]... --> New jComponent but I don't understant so much. Thank yoy ---------------------------------------------------------------------- jmpessoa · 2021-07-14 21:21 OK, the JAVA "samples"  is here: https://datalogic.github.io/android/samples/ Which of these [samples] do you want to start with? ---------------------------------------------------------------------- jmpessoa · 2021-07-15 05:56 You can get from here: (opendrive.com) https://od.lk/f/Ml8xOTc0OTIwNzNf a complete tutorial (from image1 to image34) how to add an "online" library to LAMW [new jComponent]!!! However the "datalogic"  APIs tested in LAMW code returned nothing (nil)... In fact the library source code pointed by Android Studio is clearly returning null in several APIs.... ---------------------------------------------------------------------- engkin · 2021-07-15 09:26 This tutorial will be buried here. Shouldn't it be in a better place, like a wiki page or github folder? ---------------------------------------------------------------------- af0815 · 2021-07-15 12:42 strange, i didnt know the power of lamw. But with this pictures. THX to jmpessoa +1 for safe this picture tutorial on a safe place yes, i know datalogic and the devices too :-) ---------------------------------------------------------------------- schumi · 2021-07-19 15:59 Quote from: jmpessoa on July 14, 2021, 11:21:56 pm OK, the JAVA "samples"  is here: https://datalogic.github.io/android/samples/ Which of these [samples] do you want to start with? First I need read barcode via Intent, in other device it is enough to use jBroadcastReceiver and jIntentManager, in this device no. I thought it was enough to add the SDK in the dependencies, but.... ---------------------------------------------------------------------- jmpessoa · 2021-07-19 16:51 You can try:   [need only Ant builder....] jZBarcodeScannerView   [Android Bridges]            and look for demo in LAMW folder            ".....demos/GUI"' jBarcodeGen                 [Android Bridges Extras]   and look for demo in LAMW folder            ".....demos/GUI"'