Recent

Author Topic: [SOLVED] App Crash after update lazarus + LAMW  (Read 7628 times)

schumi

  • New Member
  • *
  • Posts: 43
[SOLVED] App Crash after update lazarus + LAMW
« on: June 07, 2021, 09:42:59 am »
Hi,
I have update lazarus + LAMW with FpCupDeluxe 1.8.2t 32bit with the new function [Android LAMW], now all app crash when a second form (also lamw demo app)

someone have same problem?

thanks
« Last Edit: June 14, 2021, 06:30:45 pm by schumi »

WayneSherman

  • Full Member
  • ***
  • Posts: 243
Re: App Crash after update lazarus + LAMW
« Reply #1 on: June 07, 2021, 10:19:23 pm »
now app crash when a second form (also lamw demo app)
someone have same problem?

Yes, I can confirm.  I just did a test build with AppDemo1 and it crashes when I press any of the buttons which open another form.

(I had to tweak some of the code and project options to get it to compile without errors)

Test environment:
Xubuntu 20.04 64-bit
installed using FPCUPdeluxe ver 1.8.2u
FPC stable v3.2.2
Lazarus stable v2.0.12
LAMW git from 2021-Jun-05

Android Command-Line Tools build 7302050
OpenJDK 11
Android SDK/API Level 29 (Android 10)
Android NDK revision 22
Gradle 6.8.3 (installed automatically by FPCUPdeluxe)

64-bit CPU Target: Aarch64
Target SDK 29

Tested on Google Pixel 4 (Android 11)
« Last Edit: June 08, 2021, 05:01:29 pm by WayneSherman »

Mongkey

  • Sr. Member
  • ****
  • Posts: 430
Re: App Crash after update lazarus + LAMW
« Reply #2 on: June 08, 2021, 12:37:04 pm »
Maybe you can try create another form at main activity on creating activity, dont do create on onshow or on jniprompt. This one works for me. The last versio,n More smooth and lighter i think.
« Last Edit: June 08, 2021, 01:24:05 pm by Mongkey »

schumi

  • New Member
  • *
  • Posts: 43
Re: App Crash after update lazarus + LAMW
« Reply #3 on: June 08, 2021, 01:59:44 pm »
I use this code in a button to open form, I have 4 form in my app

Code: Pascal  [Select][+][-]
  1. if(AndroidModule2 = nil) then
  2.   begin
  3.       gApp.CreateForm(TAndroidModule2, AndroidModule2);
  4.  
  5.       AndroidModule2.InitShowing(gApp); <-- crash here
  6.   end
  7.   else
  8.   begin
  9.     AndroidModule2.Show;
  10.   end;
  11.  

Mongkey

  • Sr. Member
  • ****
  • Posts: 430
Re: App Crash after update lazarus + LAMW
« Reply #4 on: June 08, 2021, 02:41:44 pm »
Put all creating forms on, oncreate activity on main activity form. Dont put under button click, onshow, onjniprompt, it used to work, but not anymore -> You got new androidx  :D
« Last Edit: June 08, 2021, 03:38:11 pm by Mongkey »

schumi

  • New Member
  • *
  • Posts: 43
Re: App Crash after update lazarus + LAMW
« Reply #5 on: June 08, 2021, 04:31:16 pm »
Quote
Put all creating forms on, oncreate activity on main activity form. Dont put under button click, onshow, onjniprompt, it used to work, but not anymore -> You got new androidx 

how to switch to second form ? AndroidModule2.Show; dosn't work

thanks

WayneSherman

  • Full Member
  • ***
  • Posts: 243
Re: App Crash after update lazarus + LAMW
« Reply #6 on: June 08, 2021, 04:58:42 pm »
I have update lazarus + LAMW with FpCupDeluxe 1.8.2t 32bit with the new function [Android LAMW], now all app crash when a second form (also lamw demo app)
someone have same problem?

I recommend opening a bug report so this issue can be tracked:
https://github.com/jmpessoa/lazandroidmodulewizard/issues

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1739
Re: App Crash after update lazarus + LAMW
« Reply #7 on: June 08, 2021, 05:05:30 pm »
Confirmed. Its caused by LAMW itself. This will be hard to solve due to the many changes that were made the last couple of weeks. Will look into.

schumi

  • New Member
  • *
  • Posts: 43
Re: App Crash after update lazarus + LAMW
« Reply #8 on: June 08, 2021, 05:22:39 pm »
Quote

I recommend opening a bug report so this issue can be tracked:
https://github.com/jmpessoa/lazandroidmodulewizard/issues

Done.

thanks to all

WayneSherman

  • Full Member
  • ***
  • Posts: 243
Re: App Crash after update lazarus + LAMW
« Reply #9 on: June 08, 2021, 05:27:06 pm »

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: App Crash after update lazarus + LAMW
« Reply #10 on: June 08, 2021, 05:54:00 pm »
Hi guys,

After many nights trying things to solve the error that when updating the android version the apps were blocked. The solution was very simple to separate "gApp.CreateForm" and place it in "controls.lpr"

Code: Pascal  [Select][+][-]
  1. begin
  2.   gApp:= jApp.Create(nil);{AndroidWidget.pas}
  3.   gApp.Title:= 'My Android Bridges Library';
  4.   gjAppName:= 'com.example.appdemo1';{AndroidWidget.pas}
  5.   gjClassName:= 'com/example/appdemo1/Controls';{AndroidWidget.pas}
  6.   gApp.AppName:=gjAppName;
  7.   gApp.ClassName:=gjClassName;
  8.   gApp.Initialize;
  9.  
  10.   gApp.CreateForm(TAndroidModule2, AndroidModule2);
  11.   gApp.CreateForm(TAndroidModule3, AndroidModule3);
  12.   gApp.CreateForm(TAndroidModule4, AndroidModule4);
  13.   gApp.CreateForm(TAndroidModule5, AndroidModule5);
  14.   gApp.CreateForm(TAndroidModule6, AndroidModule6);
  15.   gApp.CreateForm(TAndroidModule7, AndroidModule7);
  16.   gApp.CreateForm(TAndroidModule8, AndroidModule8);
  17.   gApp.CreateForm(TAndroidModule9, AndroidModule9);
  18.   gApp.CreateForm(TAndroidModule10, AndroidModule10);
  19.   gApp.CreateForm(TAndroidModule11, AndroidModule11);
  20.   gApp.CreateForm(TAndroidModule12, AndroidModule12);
  21.   gApp.CreateForm(TAndroidModule13, AndroidModule13);
  22.   gApp.CreateForm(TAndroidModule14, AndroidModule14);
  23.  
  24.   gApp.CreateForm(TAndroidModule1, AndroidModule1);
  25. end.

Creating the secondary forms first and the main one last.

Then I usually create a code in the main form that initializes all the forms. And finally I am calling each form with the "Show" method as needed.

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: App Crash after update lazarus + LAMW
« Reply #11 on: June 08, 2021, 05:55:24 pm »
A new version of "AppDemo1" is already uploaded to github with this bug fixed.

WayneSherman

  • Full Member
  • ***
  • Posts: 243
Re: App Crash after update lazarus + LAMW
« Reply #12 on: June 08, 2021, 06:14:45 pm »
After many nights trying things to solve the error that when updating the android version the apps were blocked. The solution was very simple to separate "gApp.CreateForm" and place it in "controls.lpr"...
Creating the secondary forms first and the main one last.

For resource management, it is often desirable to create forms only when needed instead of creating all of them at the start.  Is it no longer possible to create and show forms (modules) dynamically when they are needed?  (which is a common pattern in Object Pascal)



ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: App Crash after update lazarus + LAMW
« Reply #13 on: June 08, 2021, 06:37:52 pm »
After many nights trying things to solve the error that when updating the android version the apps were blocked. The solution was very simple to separate "gApp.CreateForm" and place it in "controls.lpr"...
Creating the secondary forms first and the main one last.

For resource management, it is often desirable to create forms only when needed instead of creating all of them at the start.  Is it no longer possible to create and show forms (modules) dynamically when they are needed?  (which is a common pattern in Object Pascal)

If it is possible to create them, from my experience if you have an app that dynamically creates forms and the user of your app updates their mobile (security update for example) your app will stop working and will generate a fatal error when creating a form dynamically. With which you will have to uninstall the app and reinstall it so that it works again.

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: App Crash after update lazarus + LAMW
« Reply #14 on: June 08, 2021, 06:40:54 pm »
Actually, when a "gApp.CreateForm" is done, it hardly consumes resources, the resources are consumed when the ".Init (gApp)" is done, which can be done anywhere in the app.

 

TinyPortal © 2005-2018