I am using RAD Studio XE-5 to create Android applications, but recently stumbled into a puzzling error. TStringList.AddObject raises the following exception:
Project Project3.apk raised exception class Segmentation fault (11).
My code is this
procedure TMainForm.FormCreate(Sender: TObject);
var
list: TStrings;
begin
list := TStringList.Create;
list.AddObject('Joe', TObject(1)); // This is where exception is raised
list.AddObject('Hans', TObject(2));
end;
This code runs perfectly fine on the 32-bit Windows target, but raises the aforementioned exception when run (in debug mode) on my Nexus 7 (which runs fine when I'm not using TStringList.AddObject). If I run the app without debug it just shuts down on my Nexus.
Is this a known problem/limitation of Delphi Android? Is there a workaround or a recommended way to achieve the same result (not just for this toy example but for using AddObject in general)?
Pointer?