Lazarus

Programming => Operating Systems => Android => Topic started by: freris on December 04, 2018, 07:19:18 pm

Title: <SOLVED> INDY 10 And LAMW
Post by: freris on December 04, 2018, 07:19:18 pm
Hi to All !

I have a problem with Indy components (latest version 10.6)  and my Android application. Once I place any indy component in the application form, and install it on my mobile phone (Android 5.1 - Samsung S4 Phone), the application crashed immediately.

My IDE is Laz4Android 1.8 and latest version of LAMW.

NDK r15c and SDK 25.2.5, JDK 1.8.0.25 (No difference with NDK r17 or r18

Please help !

Thank you
Title: Re: INDY 10 And LAMW
Post by: jmpessoa on December 04, 2018, 07:49:37 pm
Hi, Freris!

1) goto "Project" ---> "Project Inspector"

....Exists any LCL dependency?

2) gotp  "Package" ---> "Open package File"   and open Indy  installed Indy
package.... Exists any LCL dependency?

Title: Re: INDY 10 And LAMW
Post by: freris on December 04, 2018, 08:05:46 pm
Thanks jmpessoa for your answer.

In my project no LCL dependency exists.

In Indy package - yes exists ! What i have to do ? Delete dependency ?

Note that with laz4android version 1.6 I did not have a problem with my application....

Now i have removed LCL from Indy, making a clean / build but with same results
Title: Re: INDY 10 And LAMW
Post by: jmpessoa on December 04, 2018, 08:31:48 pm
No! 
But we can ask the Author!
[only package "LCLBase"  dependecy is allowed...]
Title: Re: INDY 10 And LAMW
Post by: freris on December 04, 2018, 08:36:48 pm
Ok jmpessoa

Can you do it ?  I mean, ask the author ?
Title: Re: INDY 10 And LAMW
Post by: jmpessoa on December 04, 2018, 08:45:28 pm

Hello, Remy Lebeau!

Please,  can you help here?

[Laz4Android + LAMW + Indy compatibility ...]

refs.
https://sourceforge.net/projects/laz4android/
https://github.com/jmpessoa/lazandroidmodulewizard

Thank you!!!
Title: Re: INDY 10 And LAMW
Post by: freris on December 04, 2018, 08:47:26 pm
Ok Thank you.

I will be waiting for an answer
Title: Re: INDY 10 And LAMW
Post by: Remy Lebeau on December 04, 2018, 09:00:54 pm
I have a problem with Indy components (latest version 10.6)  and my Android application.

Which EXACT version of Indy are you using?  10.6 is very broad.  The current version is 10.6.2.5488.

Once I place any indy component in the application form, and install it on my mobile phone (Android 5.1 - Samsung S4 Phone), the application crashed immediately.

Crashes HOW exactly?  Is there an error message?  What is it?  And are you SURE it is Indy that is crashing?

In my project no LCL dependency exists.

In Indy package - yes exists ! What i have to do ? Delete dependency ?

Which dependency are you referring to exactly?

Note that with laz4android version 1.6 I did not have a problem with my application....

So, if you simply updated to a newer Laz4Android, why do you think this is an Indy issue?
Title: Re: INDY 10 And LAMW
Post by: freris on December 04, 2018, 09:08:21 pm
Yes Indy is my problem. And i have the latest version. Yes

Look below:

Once I place any indy component in the application form, and install it on my mobile phone (Android 5.1 - Samsung S4 Phone), the application crashed immediately.

I wonder why with older versions of indy and laz4android my application works ok.

I will try to install again the older versions of laz4android and indy 10.2 and Lamw also.

And i hope to begin work again with my project

Title: Re: INDY 10 And LAMW
Post by: jmpessoa on December 04, 2018, 10:18:33 pm

Hi, freris!

Please, try   "Run" -->  "Clen up and Build" 

before  "[LAMW] build Android Apk ..."
Title: Re: INDY 10 And LAMW
Post by: Remy Lebeau on December 04, 2018, 10:26:10 pm
Once I place any indy component in the application form, and install it on my mobile phone (Android 5.1 - Samsung S4 Phone), the application crashed immediately.

But, that does not tell me anything about HOW it is crashing, or WHERE it is crashing.

Do you have the same problem if you instantiate the Indy component(s) dynamically in code at runtime, instead of at design-time?  Can you put a try/except block around the instantiation and catch the failure?

I wonder why with older versions of indy and laz4android my application works ok.

I can't answer that without more information about the actual crash itself.
Title: Re: INDY 10 And LAMW
Post by: freris on December 04, 2018, 11:10:57 pm
I can not have details of how the error is generated. Simply starting the application gives the message unfortunately app has stopped.

Is it possible that fpc(3.0.4) is responsible?

Ok tomorrow i will try the older versions and i hope to make my app working again.

Thank you.
Title: Re: INDY 10 And LAMW
Post by: Remy Lebeau on December 05, 2018, 02:47:58 am
I can not have details of how the error is generated. Simply starting the application gives the message unfortunately app has stopped.

What about Android's own application logging?  Any error message in there about why it thinks the app stopped?

And you didn't answer my question - if you change your project to instantiate the Indy components in code at runtime, instead of dropping them on your Form at design-time, do you get the same crash?  And if so, can you catch that error?
Title: Re: INDY 10 And LAMW
Post by: freris on December 05, 2018, 12:02:54 pm
First, sorry for my bad English and also yesterday here in Greece it was late night...

Second, Thank you for all your answers.

I will describe exactly the steps I have followed below.

Quote
And you didn't answer my question - if you change your project to instantiate the Indy components in code at runtime, instead of dropping them on your Form at design-time, do you get the same crash?  And if so, can you catch that error?

Yes i have change my project to instantiate the Indy components in code at runtime but the same results.

Also I found that if I add to my project as depenedecy the indy package (indylaz) without adding any indy component to the form, i have the same results - Crash on start up.

A strange think that occurs after all updates (indy - laz4android - LAMW) is that during android compilation, i got the message "unit iconvec not found" - I have attach a jpg file to see exactly.

Ok i found that this unit is in fpc folder (..\fpc\3.0.4\source\packages\iconvenc\src). i add the path to laz4android search path and then i have another error.

Error linking....

I search on internet and i found that this error occurs because missing the library libiconv.so.  So i found in github a precompiled library for android and i put in project folder (..\jni\).

Then ok, the compilation it was done safely and correctly. Then i build the apk.

And when upload the apk in phone, i have the problems I mentioned above.

Also i have attach the logcat file to see what happens. Look and search for " ipannouncer " - it is my app.

Thank you very much one more time...
Title: Re: INDY 10 And LAMW
Post by: Remy Lebeau on December 05, 2018, 08:26:04 pm
Quote
And you didn't answer my question - if you change your project to instantiate the Indy components in code at runtime, instead of dropping them on your Form at design-time, do you get the same crash?  And if so, can you catch that error?

Yes i have change my project to instantiate the Indy components in code at runtime but the same results.

At app startup again?  Or at the time the code actually creates instances of the Indy components?

If the former, then the crash is likely happening during unit initialization.

If the latter, the crash is likely during class construction, and you should be able to use a try/except to catch it.

Also I found that if I add to my project as depenedecy the indy package (indylaz) without adding any indy component to the form, i have the same results - Crash on start up.

So, it is likely a crash during unit initialization.  Several of Indy's units have initialization sections on them, to setup global resources and such.

A strange think that occurs after all updates (indy - laz4android - LAMW) is that during android compilation, i got the message "unit iconvec not found"

Indy uses the iconv library on Unix platforms, which includes Android (which is a Java layer running on top of Linux).  Indy uses the iconvenc unit when compiled in FPC.

Ok i found that this unit is in fpc folder (..\fpc\3.0.4\source\packages\iconvenc\src). i add the path to laz4android search path and then i have another error.

Error linking....

I search on internet and i found that this error occurs because missing the library libiconv.so.  So i found in github a precompiled library for android and i put in project folder (..\jni\).

OK.

Also i have attach the logcat file to see what happens. Look and search for " ipannouncer " - it is my app.

The only errors I see that are related to an app crash as follows, but they have nothing to do with Indy, they look more like the UI framework crashed during initialization:

Quote
E/art     (17226): dlopen("/data/app/org.dublex.ipannouncer-1/lib/arm/libipannouncer_udp.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "CONTROLS$_$TCONTROLACTIONLINK_$__$$_ASSIGNCLIENT$TOBJECT" referenced by "libipannouncer_udp.so"...
E/JNI_Loading_libipannouncer_udp(17226): exception
E/JNI_Loading_libipannouncer_udp(17226): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "CONTROLS$_$TCONTROLACTIONLINK_$__$$_ASSIGNCLIENT$TOBJECT" referenced by "libipannouncer_udp.so"...
E/JNI_Loading_libipannouncer_udp(17226):    at java.lang.Runtime.loadLibrary(Runtime.java:371)
E/JNI_Loading_libipannouncer_udp(17226):    at java.lang.System.loadLibrary(System.java:989)
E/JNI_Loading_libipannouncer_udp(17226):    at org.dublex.ipannouncer.Controls.<clinit>(Controls.java:1445)
E/JNI_Loading_libipannouncer_udp(17226):    at org.dublex.ipannouncer.App.onCreate(App.java:56)
E/JNI_Loading_libipannouncer_udp(17226):    at android.app.Activity.performCreate(Activity.java:6289)
E/JNI_Loading_libipannouncer_udp(17226):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
E/JNI_Loading_libipannouncer_udp(17226):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
E/JNI_Loading_libipannouncer_udp(17226):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
E/JNI_Loading_libipannouncer_udp(17226):    at android.app.ActivityThread.access$900(ActivityThread.java:177)
E/JNI_Loading_libipannouncer_udp(17226):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
E/JNI_Loading_libipannouncer_udp(17226):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/JNI_Loading_libipannouncer_udp(17226):    at android.os.Looper.loop(Looper.java:145)
E/JNI_Loading_libipannouncer_udp(17226):    at android.app.ActivityThread.main(ActivityThread.java:5951)
E/JNI_Loading_libipannouncer_udp(17226):    at java.lang.reflect.Method.invoke(Native Method)
E/JNI_Loading_libipannouncer_udp(17226):    at java.lang.reflect.Method.invoke(Method.java:372)
E/JNI_Loading_libipannouncer_udp(17226):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
E/JNI_Loading_libipannouncer_udp(17226):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
E/art     (17226): No implementation found for int org.dublex.ipannouncer.Controls.pAppOnScreenStyle() (tried Java_org_dublex_ipannouncer_Controls_pAppOnScreenStyle and Java_org_dublex_ipannouncer_Controls_pAppOnScreenStyle__)
D/AndroidRuntime(17226): Shutting down VM
E/AndroidRuntime(17226): FATAL EXCEPTION: main
E/AndroidRuntime(17226): Process: org.dublex.ipannouncer, PID: 17226
E/AndroidRuntime(17226): java.lang.UnsatisfiedLinkError: No implementation found for int org.dublex.ipannouncer.Controls.pAppOnScreenStyle() (tried Java_org_dublex_ipannouncer_Controls_pAppOnScreenStyle and Java_org_dublex_ipannouncer_Controls_pAppOnScreenStyle__)
E/AndroidRuntime(17226):    at org.dublex.ipannouncer.Controls.pAppOnScreenStyle(Native Method)
E/AndroidRuntime(17226):    at org.dublex.ipannouncer.Controls.jAppOnScreenStyle(Controls.java:1450)
E/AndroidRuntime(17226):    at org.dublex.ipannouncer.App.onCreate(App.java:60)
E/AndroidRuntime(17226):    at android.app.Activity.performCreate(Activity.java:6289)
E/AndroidRuntime(17226):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
E/AndroidRuntime(17226):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
E/AndroidRuntime(17226):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
E/AndroidRuntime(17226):    at android.app.ActivityThread.access$900(ActivityThread.java:177)
E/AndroidRuntime(17226):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
E/AndroidRuntime(17226):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(17226):    at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime(17226):    at android.app.ActivityThread.main(ActivityThread.java:5951)
E/AndroidRuntime(17226):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(17226):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(17226):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
E/AndroidRuntime(17226):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
...
W/ActivityManager(  878):   Force finishing activity org.dublex.ipannouncer/.App
...
D/CrashAnrDetector(  878): processName: org.dublex.ipannouncer
D/CrashAnrDetector(  878): broadcastEvent : null data_app_crash
...
I/ActivityManager(  878): Process org.dublex.ipannouncer (pid 17226)(adj 15) has died(54,368)
Title: Re: INDY 10 And LAMW
Post by: freris on December 05, 2018, 08:35:33 pm
 Ok Remy

Thank you very much for your answers.

I will search the code again or I will go back to the older versions
Title: Re: INDY 10 And LAMW
Post by: freris on December 09, 2018, 07:27:23 pm
Finally solved the problem myself.

The problem is that there is no backward compatibility of the new versions of the indy package.

They use the iconvec which is incompatible with the api 21 that has my phone. So I found the older indy version 10.2.0 and followed the steps below.

I did not change laz4android version 1.80.

I did not changed the latest version of LAMW.

I did not change version 3.0.4 of fpc.

I also had to have the indylaz package on the dependencies, but may not exist in their program uses. Is critical!

And everything worked as it should


I use the indy package for many years and it is very reliable. I did not want to use other internet packages

Thanks
Title: Re: INDY 10 And LAMW
Post by: jmpessoa on December 09, 2018, 08:01:40 pm
Good!

Please, put here some simple    LAMW+ Indy  "demo"  !!

So,  I will  commit to the  LAMW  git repository...

Thank you!
Title: Re: INDY 10 And LAMW
Post by: freris on December 09, 2018, 08:05:13 pm
Ok jmpessoa.

I will attach tomorrow a zip file with a sample project.

Thank you
Title: [Solved] - INDY 10 And LAMW
Post by: freris on December 10, 2018, 03:45:19 pm
Hi.

I attach the dropbox link

https://www.dropbox.com/sh/diw045ywo768ehd/AAD1UzwOiIr83MTQisclclEPa?dl=0 (https://www.dropbox.com/sh/diw045ywo768ehd/AAD1UzwOiIr83MTQisclclEPa?dl=0)

that includes the sample of my project that uses indylaz and LAMW, I also include the indylaz package that is hard to find. And a screenshot showing which is placed the indylaz dependency.

Thank you
Title: Re: INDY 10 And LAMW
Post by: Remy Lebeau on December 10, 2018, 08:53:02 pm
The problem is that there is no backward compatibility of the new versions of the indy package.

They use the iconvec which is incompatible with the api 21 that has my phone.

In what way exactly?  Can you be more specific?  Indy does not use any of the Android APIs directly.  Indy operates at the native Linux POSIX layer that runs underneath Android's Java layer.  ICONV is a Linux native library, and iconvenc is a FPC provided unit.  In what way is it not compatible with Android?

So I found the older indy version 10.2.0 and followed the steps below.

That is an extremely old version of Indy, you really should not use it.  I'd rather understand why the latest version is not working for you so it can be fixed.
Title: Re: INDY 10 And LAMW
Post by: freris on December 10, 2018, 08:59:35 pm
Thank you for your interest.

 I do not know many things about android and java.
Only pascal.

But as long as the work is done it does not matter.

Thank you very much.
Title: Re: <SOLVED> INDY 10 And LAMW
Post by: freris on December 17, 2018, 06:07:48 pm
Hi again.

And to conclude and close this discussion, see what exactly is going on with my problem as mentioned in the relevant forum.

https://github.com/android-ndk/ndk/issues/702#issuecomment-391039098 (https://github.com/android-ndk/ndk/issues/702#issuecomment-391039098)

Thank you
Title: Re: INDY 10 And LAMW
Post by: bmcsoft on July 09, 2020, 09:28:42 am
Finally solved the problem myself.

The problem is that there is no backward compatibility of the new versions of the indy package.

They use the iconvec which is incompatible with the api 21 that has my phone. So I found the older indy version 10.2.0 and followed the steps below.

How to compile last Indy10 for Android? Author of Indy do not recommend use 10.2.0 now.
If iconvenc is incompatible with the API 21, which version API working with it?

Someone can fix the iconvenc to working on all version of Android including API 21?

Title: Re: <SOLVED> INDY 10 And LAMW
Post by: DonAlfredo on July 09, 2020, 10:06:55 am
As I stumbled into the same issue some time ago, I just compiled iconv myself.
Both static libs and dynamic libs are available at the links. I would 100% recommend the static libs !

https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.6.8z/dynamiclibs.zip
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.6.8z/staticlibs.zip
Title: Re: <SOLVED> INDY 10 And LAMW
Post by: freris on July 09, 2020, 01:26:39 pm
Thank you DonAlfredo.

I will try these libraries as soon as possible.

Thank's again
Title: Re: <SOLVED> INDY 10 And LAMW
Post by: bmcsoft on July 09, 2020, 05:12:28 pm
And to conclude and close this discussion, see what exactly is going on with my problem as mentioned in the relevant forum.
https://github.com/android-ndk/ndk/issues/702#issuecomment-391039098 (https://github.com/android-ndk/ndk/issues/702#issuecomment-391039098)
I read this article and didn't find anything useful.

Quote
-Interesting... Does this mean that iconv is available in devices starting API 28?
-Yes
I've compiled and running last Indy10 application on Android9 (Genymotion), Android10 (real phone Xiaomi Mi9). It's crushing all time and doesn't work.

Quote
Will update Android NDK for r17b.
It doesn't work either.


Title: Re: <SOLVED> INDY 10 And LAMW
Post by: bmcsoft on July 09, 2020, 06:26:20 pm
I would 100% recommend the static libs !

I put "libiconv.a" in a JNI-folder. Compiled successfully. On Android8 it's crashed when starting app.
On Android10 compiled application starts normally, but when I press jButton on the main form and dynamically create TIdUDPServer and trying to send packet - it's crashed also.

That is an extremely old version of Indy, you really should not use it.  I'd rather understand why the latest version is not working for you so it can be fixed.

I need to use Android7 and Android8 devices for my working app.
Should I use the old version Indy 10.2.0.3 anyway?

Title: Re: <SOLVED> INDY 10 And LAMW
Post by: Remy Lebeau on July 09, 2020, 07:17:15 pm
I've compiled and running last Indy10 application on Android9 (Genymotion), Android10 (real phone Xiaomi Mi9). It's crushing all time and doesn't work.

Can you be more specific?  Crashing HOW exactly?  What is the actual error message, and WHERE is it occurring?

On Android8 it's crashed when starting app.
On Android10 compiled application starts normally, but when I press jButton on the main form and dynamically create TIdUDPServer and trying to send packet - it's crashed also.

Again, HOW and WHERE is it crashing exactly?

Should I use the old version Indy 10.2.0.3 anyway?

NO, it is way too old.  The current version is 10.6.2.  A LOT has changed since 10.2.0.  I'm not going to provide support for such an old version.
Title: Re: <SOLVED> INDY 10 And LAMW
Post by: Segator on August 15, 2020, 09:35:15 pm
the same problem with last indy version in android 10 with lamw, first when i try to build the application with idhttp and idssl... not compile because not found the iconvec library, i solve it coping the 3 libray file to the System indy folder, then when it build the app run good but when i start the ld http client the application it's closed with no error message.
TinyPortal © 2005-2018