[SOLVED] App Crash after update lazarus + LAMW lazarus / 43-Android ---------------------------------------------------------------------- schumi · 2021-06-07 07:42 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 ---------------------------------------------------------------------- WayneSherman · 2021-06-07 20:19 Quote from: schumi on June 07, 2021, 09:42:59 amnow 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) ---------------------------------------------------------------------- Mongkey · 2021-06-08 10:37 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. ---------------------------------------------------------------------- schumi · 2021-06-08 11:59 I use this code in a button to open form, I have 4 form in my app Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if(AndroidModule2 = nil) then  begin      gApp.CreateForm(TAndroidModule2, AndroidModule2);       AndroidModule2.InitShowing(gApp); <-- crash here  end  else  begin    AndroidModule2.Show;  end; ---------------------------------------------------------------------- Mongkey · 2021-06-08 12:41 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 ---------------------------------------------------------------------- schumi · 2021-06-08 14:31 QuotePut 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 · 2021-06-08 14:58 Quote from: schumi on June 07, 2021, 09:42:59 amI 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 · 2021-06-08 15:05 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 · 2021-06-08 15:22 Quote I recommend opening a bug report so this issue can be tracked: https://github.com/jmpessoa/lazandroidmodulewizard/issues Done. thanks to all ---------------------------------------------------------------------- WayneSherman · 2021-06-08 15:27 Thanks.  Reference Github Issue: https://github.com/jmpessoa/lazandroidmodulewizard/issues/384 ---------------------------------------------------------------------- ADiV · 2021-06-08 15:54 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin  gApp:= jApp.Create(nil);{AndroidWidget.pas}  gApp.Title:= 'My Android Bridges Library';  gjAppName:= 'com.example.appdemo1';{AndroidWidget.pas}  gjClassName:= 'com/example/appdemo1/Controls';{AndroidWidget.pas}  gApp.AppName:=gjAppName;  gApp.ClassName:=gjClassName;  gApp.Initialize;   gApp.CreateForm(TAndroidModule2, AndroidModule2);  gApp.CreateForm(TAndroidModule3, AndroidModule3);  gApp.CreateForm(TAndroidModule4, AndroidModule4);  gApp.CreateForm(TAndroidModule5, AndroidModule5);  gApp.CreateForm(TAndroidModule6, AndroidModule6);  gApp.CreateForm(TAndroidModule7, AndroidModule7);  gApp.CreateForm(TAndroidModule8, AndroidModule8);  gApp.CreateForm(TAndroidModule9, AndroidModule9);  gApp.CreateForm(TAndroidModule10, AndroidModule10);  gApp.CreateForm(TAndroidModule11, AndroidModule11);  gApp.CreateForm(TAndroidModule12, AndroidModule12);  gApp.CreateForm(TAndroidModule13, AndroidModule13);  gApp.CreateForm(TAndroidModule14, AndroidModule14);   gApp.CreateForm(TAndroidModule1, AndroidModule1);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 · 2021-06-08 15:55 A new version of "AppDemo1" is already uploaded to github with this bug fixed. ---------------------------------------------------------------------- WayneSherman · 2021-06-08 16:14 Quote from: ADiV on June 08, 2021, 05:54:00 pmAfter 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 · 2021-06-08 16:37 Quote from: WayneSherman on June 08, 2021, 06:14:45 pmQuote from: ADiV on June 08, 2021, 05:54:00 pmAfter 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 · 2021-06-08 16:40 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. ---------------------------------------------------------------------- Mongkey · 2021-06-09 01:48 let say your first creation form named splash, then you also want create setting form, the case would be like this picture attached. if want calling setting form, just by calling setting.show on every desired form you want to call. i already tested my app on android 11 emulator and it was surprisingly ok. ---------------------------------------------------------------------- schumi · 2021-06-14 16:33 Hi, work's with ADiV's way and also Mongkey's way too thank you ---------------------------------------------------------------------- jmpessoa · 2021-06-14 16:56 QuoteHi, work's with ADiV's way and also Mongkey's way too Nice! Thank you! ---------------------------------------------------------------------- jmpessoa · 2021-07-05 10:14 Hi, All About "App Crash after update lazarus + LAMW" We just apply a patch to try improve and fix some  issues pointed here! Thanks to everyone!