Recent

Author Topic: LAMW - "This app has a bug" Android 12 error  (Read 2304 times)

Agmcz

  • New Member
  • *
  • Posts: 46
Re: LAMW - "This app has a bug" Android 12 error
« Reply #15 on: June 19, 2022, 03:43:40 pm »
I will update LAMW, CLEAN and tell you result, if problem is solved or not.

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: LAMW - "This app has a bug" Android 12 error
« Reply #16 on: June 23, 2022, 08:09:35 am »
Hi guys,
  I also had the same problem with the applications in android 12, I tried on a real device the "debug" version worked correctly and the "release" version died horribly. After many tests with LAMW I discovered the bug:

Code: [Select]
This line of code generated the error:
 //InitInheritedComponent(Self, TAndroidWidget {TAndroidForm});
 InitInheritedComponent(Self, jForm {Need for Android 12});

Another particularity of Google Play is that you cannot create "CreateForm" anywhere, only the "begin ... end" of the "Project source" but when the operating system is updated, your application will stop working.

Code: [Select]
//Example
begin
  gApp:= jApp.Create(nil);
  gApp.Title:= 'LAMW JNI Android Bridges Library';
  gjAppName:= 'org.lamw.doubleflashfree';
  gjClassName:= 'org/lamw/doubleflashfree/Controls';
  gApp.AppName:=gjAppName;
  gApp.ClassName:=gjClassName;
  gApp.Initialize;
  gapp.CreateForm(TfrmTools, frmTools);
  gapp.CreateForm(TfrmScreen, frmScreen);
  gapp.CreateForm(TfrmTime, frmTime);
  gapp.CreateForm(TfrmParty, frmParty);
  gapp.CreateForm(TfrmSOS, frmSOS);
  gapp.CreateForm(TfrmConfig, frmConfig);
  gapp.CreateForm(TfrmQR, frmQR);
  gapp.CreateForm(TfrmZoom, frmZoom);
  gapp.CreateForm(TfrmPro, frmPro);

  gApp.CreateForm(TfrmSplash, frmSplash);
end.

I have also improved certain things such as compatibility with mipmap so that in Android 12 it loads the icons correctly.

Multidex support to avoid problems with the 64k limit.

Greetings.

neuro

  • Jr. Member
  • **
  • Posts: 62
Re: LAMW - "This app has a bug" Android 12 error
« Reply #17 on: June 24, 2022, 07:40:51 pm »
Please, update LAMW from github and run "Clean up and Build"  before make your apk again....
I think that this issue was fixed by @ADiV

ADiV, have you already updated LAMW code in github to be compatible with Android 12?
When we can download fixed LAMW which is compatible with Android 12?
All my apps made with LAMW crash in Android 12, so this is urgent issue.

BeniBela

  • Hero Member
  • *****
  • Posts: 844
    • homepage
Re: LAMW - "This app has a bug" Android 12 error
« Reply #18 on: June 25, 2022, 10:56:43 am »
Does that issue affect me when I do not use LAMW, but FPC-only ?

Mongkey

  • Sr. Member
  • ****
  • Posts: 256
Re: LAMW - "This app has a bug" Android 12 error
« Reply #19 on: June 27, 2022, 05:37:38 am »
I hope this works to all, thank you.  :) , CTRL+F1 only, not need Android studio.
« Last Edit: June 27, 2022, 10:21:27 am by Mongkey »

Mongkey

  • Sr. Member
  • ****
  • Posts: 256
Re: LAMW - "This app has a bug" Android 12 error
« Reply #20 on: June 27, 2022, 05:41:49 am »
This 1, is my LAMW setting. Setted sdk is 30, but if i change to sdk 31 it also works great.

****important*****
-Create your "mipmap" folder inside res folder + add your beautiful android icon inside (just copy from xhdp folder).

If this solution is acceptable, you can close your thread with "SOLVED" mark.
« Last Edit: June 27, 2022, 07:20:12 am by Mongkey »

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: LAMW - "This app has a bug" Android 12 error
« Reply #21 on: June 27, 2022, 07:57:58 am »
Please, update LAMW from github and run "Clean up and Build"  before make your apk again....
I think that this issue was fixed by @ADiV

ADiV, have you already updated LAMW code in github to be compatible with Android 12?
When we can download fixed LAMW which is compatible with Android 12?
All my apps made with LAMW crash in Android 12, so this is urgent issue.

If it was already updated on github as soon as it was discovered.

Mongkey

  • Sr. Member
  • ****
  • Posts: 256
Re: LAMW - "This app has a bug" Android 12 error
« Reply #22 on: July 03, 2022, 05:22:38 am »
SDK 32  :), i did this until "release" mode, not only "debug" mode. No die or something.

Recipe:
1. never init something anywhere -> create your form inside main form oncreate procedure -> this would be fine/never die on your debug or release on sdk / android 12.
2. The problem is inside gradle distribution url, just change it from 6.8.3 to 7.4.2 -> if you want build it until release mode.

or select gradle >7.3.3 from this services url

https://services.gradle.org/distributions/

** LAMW need to upgrade their gradlewrapper.properties -> from max 6.8.3, or we can set it up from external tools -> bulit using old mode or recent mode. Old mode -> max 6.8.3 ,  recent mode or fresh code/recent hype sdk.  Sometimes old are best.

Thank you all LAMW contributors and creator you are awesome -> pascal great again!  :D
Happy coding to all my friend!

Old project -> throw away every line that has form.init(gApp) or form.init from entire your form.

this picture is on release mode sdk32, ndk24
« Last Edit: July 03, 2022, 11:39:39 am by Mongkey »

neuro

  • Jr. Member
  • **
  • Posts: 62
Re: LAMW - "This app has a bug" Android 12 error
« Reply #23 on: July 16, 2022, 10:53:44 pm »
The report of two bugs.

Bug #1.
Changing of Launcher icon fails to work.

Just create new project and change Launcher icon by going to menu:
Project -> Project Options -> [LAMW] Android project options -> Launcher icon

Then run menu
[LAMW] Build Android Apk and run

The result is:
Quote
Fatal: FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mergeDebugResources'.
> [mipmap/ic_launcher] D:\AppLAMWProject1\res\mipmap\ic_launcher.png   [mipmap/ic_launcher] D:\AppLAMWProject1\res\mipmap\ic_launcher.webp: Error: Duplicate resources
  [mipmap-hdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-hdpi\ic_launcher.png   [mipmap-hdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-hdpi\ic_launcher.webp: Error: Duplicate resources
  [mipmap-mdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-mdpi\ic_launcher.png   [mipmap-mdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-mdpi\ic_launcher.webp: Error: Duplicate resources
  [mipmap-xhdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-xhdpi\ic_launcher.png   [mipmap-xhdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-xhdpi\ic_launcher.webp: Error: Duplicate resources
  [mipmap-xxhdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-xxhdpi\ic_launcher.png   [mipmap-xxhdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-xxhdpi\ic_launcher.webp: Error: Duplicate resources
  [mipmap-xxxhdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-xxxhdpi\ic_launcher.png   [mipmap-xxxhdpi-v4/ic_launcher] D:\AppLAMWProject1\res\mipmap-xxxhdpi\ic_launcher.webp: Error: Duplicate resources
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.


Bug #2.
Just create new empty project:
New Project -> LAMW [GUI] Android module

Then go to the menu:
Tools -> [LAMW] Android module wizard -> Convert the Project to AppCompat Theme -> AppAppCompatNoActionBar

Lazarus crashes with the error:
Quote
"" is invalid integer

 

TinyPortal © 2005-2018