Recent

Author Topic: Lazarus 3.99 Error  (Read 1579 times)

lope

  • New member
  • *
  • Posts: 8
Lazarus 3.99 Error
« on: June 30, 2024, 06:38:47 pm »
I have Lazarus 3.99 installed for testing purpose
When I try to create new LAMW project (GUI) I got this error
Quote
List index (5) out of bounds

dsiders

  • Hero Member
  • *****
  • Posts: 1209
Re: Lazarus 3.99 Error
« Reply #1 on: June 30, 2024, 08:08:35 pm »
I have Lazarus 3.99 installed for testing purpose
When I try to create new LAMW project (GUI) I got this error
Quote
List index (5) out of bounds

If you want us to debug your code, you'll have to post your code.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

dseligo

  • Hero Member
  • *****
  • Posts: 1338
Re: Lazarus 3.99 Error
« Reply #2 on: June 30, 2024, 09:57:24 pm »
I have Lazarus 3.99 installed for testing purpose
When I try to create new LAMW project (GUI) I got this error
Quote
List index (5) out of bounds

If you want us to debug your code, you'll have to post your code.

I don't think he have code to post. IMHO, he gets error from Lazarus when he goes to menu Project, New Project and then LAMW [GUI] Android Module.

To TS: I would try to install LAMW in Lazarus 2.2.6 (I still work in LAMW with 2.2.4). In LAMW Github repository only Lazarus 2.x.y is mentioned. Maybe there is something in 3.99 that breaks LAMW.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2312
Re: Lazarus 3.99 Error
« Reply #3 on: July 01, 2024, 12:17:31 am »
Quote
In LAMW Github repository only Lazarus 2.x.y is mentioned....

Lazarus 3.2 is OK [tested for windows] by Laz4Android

ref.:
https://sourceforge.net/projects/laz4android/   
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

lope

  • New member
  • *
  • Posts: 8
Re: Lazarus 3.99 Error
« Reply #4 on: July 01, 2024, 07:06:23 am »
Thank you for your replay

I installed side by side
Lazarus 3.5 with FPC 3.2.3 for production purpose ... working fine with (LAMW)
Lazarus 3.5 with FPC 3.3.1 for production purpose to target supported platforms by FPC 3.3.1 ... also working fine (LAMW)
Lazarus 3.99 with FPC 3.3.1 for testing purpose

Ok, on Lazarus 3.99 I can ReOpen existing projects (LAMW) and rebuild without any problem but when I try to create a new project I got the error (List index (5) out of bounds) I think it related to enumeration of ide window or something like
« Last Edit: July 01, 2024, 07:08:25 am by lope »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4515
  • I like bugs.
Re: Lazarus 3.99 Error
« Reply #5 on: July 01, 2024, 08:41:54 am »
I have never used LAMW but now I installed it through OPM and tried to create a "LAMW [GUI] Android Module" project.
I got this error dialog instead :

"uninitialized function result in function TFormWorkspace" is an invalid integer

There must be an uninitialized Variant. It tries to convert text into number.
The exception happens in
Code: Pascal  [Select][+][-]
  1. function TFormWorkspace.GetNDKVersion(ndkRelease: string): integer;
  2. ...
  3.   Result:= StrToInt(Trim(strNdkVersion));
The value of ndkRelease = 'TryGetNDKRelease(pathNDK:AnsiString):AnsiString;'
Such a function (TryGetNDKRelease) is just below GetNDKVersion and indeed its return value is not initialized if there are no config files.
But how the function signature etc. ended up in a variable value? The functions are not published (no RTTI).

I initialized Result := ''; and tried again and got :
---
Warning. Minimum Target API required by "Google Play Store" = 33
Please, update your android sdk/platforms folder!
How to:
.open a command line terminal and go to folder "sdk/tools/bin"
.run the command  >>sdkmanager --update
.run the command  >>sdkmanager "build-tools;33.0.2" "platforms;android-33"

---
Who knows details of this LAMW code? Who maintains it?
There seem to be many uninitialized return values, both Integer and String types.
Note: A dynamic String is initialized elsewhere automatically but not when it is a function Result. Many years ago I opened a bug report for FPC and then learned it is a feature, not a bug.

I don't understand why the code works with earlier Lazarus versions but not with 3.99. I don't see anything version dependent there.
Somebody should debug the "List index (5) out of bounds" error. I didn't get it.
« Last Edit: July 01, 2024, 09:42:08 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2312
Re: Lazarus 3.99 Error
« Reply #6 on: July 01, 2024, 05:21:57 pm »
@ lope
Quote
when I try to create a new project I got the error (List index (5) out of bounds)
probably the fill of some control (listBox?) failed during the "new project" Form/Dialog initialization.... 


@JuhaManninen
Quote
I installed it through OPM ....
Sorry.... the installed copy by OPM  is out of date...

Quote
A dynamic String is initialized elsewhere automatically but not when it is a function Result....
Now I have learned about this! I will improve the LAMW code..

Thanks  to All!
« Last Edit: July 01, 2024, 06:19:15 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

lope

  • New member
  • *
  • Posts: 8
Re: Lazarus 3.99 Error
« Reply #7 on: July 03, 2024, 01:00:53 pm »
Unfortunately the last update (LAMW) doesn't fix the problem.
So I traced the code, the error occurred when LAMW try to create New Editor File (GUI) unfortunately I can't see what is wrong.

file:
AndroidWizard_intf.pas

line:
  LazarusIDE.DoNewEditorFile(AndroidFileDescriptor, '', '',
                             [nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);


I guess it's related to handle the value passed after (case) 0..4 that raise the exception (List index (5) out of bounds)
Code: Pascal  [Select][+][-]
  1.   case FModuleType of
  2.    0: // GUI Controls
  3.     AndroidFileDescriptor.ResourceClass:= TAndroidModule;  //GUI
  4.    1: // NoGUI
  5.     AndroidFileDescriptor.ResourceClass:= TNoGUIAndroidModule;
  6.    2: // NoGUI Console
  7.     AndroidFileDescriptor.ResourceClass:= TAndroidConsoleDataForm;
  8.    3: // NoGUI generic .so library
  9.     AndroidFileDescriptor.ResourceClass:= nil;
  10.    4: // NoGUI JNI .so library
  11.     AndroidFileDescriptor.ResourceClass:= nil;
  12.   end;
  13.  
  14.   LazarusIDE.DoSaveProject([]); // TODO: change hardcoded "controls"
  15.  
  16.   LazarusIDE.DoNewEditorFile(AndroidFileDescriptor, '', '',
  17.                              [nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);
  18.                                
  19.                                
  20.   if FModuleType = 0 then // GUI
  21.   begin
  22.     // refresh theme
  23.     with LazarusIDE do
  24.       if ActiveProject.FileCount > 1 then
  25.       begin
  26.         s := ActiveProject.Files[1];
  27.         d := GetDesignerWithProjectFile(s, True);
  28.         c := d.LookupRoot;
  29.         (TAndroidModule(c).Designer as TAndroidWidgetMediator).UpdateTheme;
  30.       end;
  31.   end;
  32.  
  33.  

 

TinyPortal © 2005-2018