Lazarus 3.99 Error lazarus / 43-Android ---------------------------------------------------------------------- lope · 2024-06-30 16:38 I have Lazarus 3.99 installed for testing purpose When I try to create new LAMW project (GUI) I got this error QuoteList index (5) out of bounds ---------------------------------------------------------------------- dsiders · 2024-06-30 18:08 Quote from: lope on June 30, 2024, 06:38:47 pmI have Lazarus 3.99 installed for testing purpose When I try to create new LAMW project (GUI) I got this error QuoteList index (5) out of bounds If you want us to debug your code, you'll have to post your code. ---------------------------------------------------------------------- dseligo · 2024-06-30 19:57 Quote from: dsiders on June 30, 2024, 08:08:35 pmQuote from: lope on June 30, 2024, 06:38:47 pmI have Lazarus 3.99 installed for testing purpose When I try to create new LAMW project (GUI) I got this error QuoteList 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 · 2024-06-30 22:17 QuoteIn 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/ ---------------------------------------------------------------------- lope · 2024-07-01 05:06 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 ---------------------------------------------------------------------- JuhaManninen · 2024-07-01 06:41 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TFormWorkspace.GetNDKVersion(ndkRelease: string): integer;...  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. ---------------------------------------------------------------------- jmpessoa · 2024-07-01 15:21 @ lope Quotewhen 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 QuoteI installed it through OPM .... Sorry.... the installed copy by OPM  is out of date... QuoteA 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! ---------------------------------------------------------------------- lope · 2024-07-03 11:00 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][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   case FModuleType of   0: // GUI Controls    AndroidFileDescriptor.ResourceClass:= TAndroidModule;  //GUI   1: // NoGUI    AndroidFileDescriptor.ResourceClass:= TNoGUIAndroidModule;   2: // NoGUI Console    AndroidFileDescriptor.ResourceClass:= TAndroidConsoleDataForm;   3: // NoGUI generic .so library    AndroidFileDescriptor.ResourceClass:= nil;   4: // NoGUI JNI .so library    AndroidFileDescriptor.ResourceClass:= nil;  end;   LazarusIDE.DoSaveProject([]); // TODO: change hardcoded "controls"   LazarusIDE.DoNewEditorFile(AndroidFileDescriptor, '', '',                           [nfIsPartOfProject,nfOpenInEditor,nfCreateDefaultSrc]);                                                                if FModuleType = 0 then // GUI  begin    // refresh theme    with LazarusIDE do      if ActiveProject.FileCount > 1 then      begin        s := ActiveProject.Files[1];        d := GetDesignerWithProjectFile(s, True);        c := d.LookupRoot;        (TAndroidModule(c).Designer as TAndroidWidgetMediator).UpdateTheme;      end;  end;