Lazarus

Programming => Operating Systems => Android => Topic started by: Agmcz on May 09, 2022, 11:39:37 pm

Title: LAMW - "This app has a bug" Android 12 error
Post by: Agmcz on May 09, 2022, 11:39:37 pm
Hello

There is a fatal error with Samsung devices and Android 12!!!

The error message is just "Something went wrong with [App]. [App] closed because this app has a bug. Try updating this app after its developer provides a fix for this error.", and then the app fails to start.

Tested on Samsung Note 10 and Samsung S9 Plus, Android 12

Lazarus
Apk builder: gradle
Chipset: Aarch64
SDK version: 31

Please fix bug
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Agmcz on May 12, 2022, 12:20:02 am
Does this mean that there is no solution to the problem?  :(
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: jmpessoa on May 12, 2022, 01:57:51 am
Quote
Does this mean that there is no solution to the problem?

No!


But a generic error message doesn't help....
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: ADiV on May 12, 2022, 09:55:41 am
Hello

There is a fatal error with Samsung devices and Android 12!!!

The error message is just "Something went wrong with [App]. [App] closed because this app has a bug. Try updating this app after its developer provides a fix for this error.", and then the app fails to start.

Tested on Samsung Note 10 and Samsung S9 Plus, Android 12

Lazarus
Apk builder: gradle
Chipset: Aarch64
SDK version: 31

Please fix bug

Try SDK version: 30 LAMW is not yet ready for SDK 31
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Agmcz on May 12, 2022, 03:40:02 pm
Thanks to reply

Quote
No!
But a generic error message doesn't help....
Error msg appears when startup app, how debugging?
Quote
Try SDK version: 30 LAMW is not yet ready for SDK 31
SDK version 30 also same problem!!
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: jmpessoa on May 12, 2022, 05:50:00 pm
Quote
Error msg appears when startup app, how debugging?

Please,  look for "android adb command line" ...

Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Mongkey on May 16, 2022, 01:58:26 am
Problem not yet appear  :D, 80% my project are using sdk 31 + gradle 7.1.3 -> android studio chipmunk for building.
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Agmcz on May 16, 2022, 06:15:40 pm
Have you tested app on your samsung note 10/s9 plus with Android 12?  :o
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Mongkey on May 17, 2022, 01:12:23 am
s20 plus -> inventory + pos -> ok -> no problem
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Agmcz on May 17, 2022, 02:42:56 pm
s20 plus -> inventory + pos -> ok -> no problem
Very cool  :'(

I use Android Studio SDK.
Can you put path to gradle for Android Studio...  :o
and jdk version

My settings are attached
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Agmcz on May 18, 2022, 01:09:25 am
I found gradle path here "C:\Users\user123\.gradle\wrapper\dists\gradle-7.3.3-bin"
I will test and come back...  8)
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Mongkey on May 18, 2022, 01:50:42 pm
Try ndk 21, gradle >7 not yet supported for building inside lazarus, you must build your project using android studio. That is the easiest to get ride sdk31 + gradle >7, but anyway that are my journey to LAMW, if you get more easy to get ride you are awesome  8)
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Agmcz on May 18, 2022, 10:32:34 pm
I used Android Studio SDK
gradle 7.3.3
ndk-r21e
there is still the same problem :o


I found this solution but it didn't work for me
https://stackoverflow.com/questions/71410279/app-is-not-working-and-shuts-down-on-samsung-galaxy-s22
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: neuro on June 15, 2022, 03:04:59 pm
I also confirm that LAMW apps crash on Android 12.
In Google Play I have a number of apps which were made using LAMW. When Android 12 was released, the crash statistics in Google Play shows that all my apps which were made using LAMW are crashing on Android 12. Unfortunately I do not have physical device running Android 12, so I am unable to find the reason of crash. In Android 12 emulator apps run fine, however apps crash on physical devices running Android 12.
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: jmpessoa on June 15, 2022, 07:30:14 pm
Quote
however apps crash on physical devices running Android 12.....


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


Thanks to All!
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Agmcz on June 19, 2022, 03:43:40 pm
I will update LAMW, CLEAN and tell you result, if problem is solved or not.
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: ADiV 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.
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: neuro 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.
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: BeniBela on June 25, 2022, 10:56:43 am
Does that issue affect me when I do not use LAMW, but FPC-only ?
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Mongkey on June 27, 2022, 05:37:38 am
I hope this works to all, thank you.  :) , CTRL+F1 only, not need Android studio.
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Mongkey 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.
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: ADiV 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.
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: Mongkey 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
Title: Re: LAMW - "This app has a bug" Android 12 error
Post by: neuro 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