Recent

Author Topic: Using LazToApk  (Read 29970 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 10430
Re: Using LazToApk
« Reply #15 on: June 30, 2015, 10:49:23 am »
Same thing as before. GPS for compiler/platform/binary paths not invented yet. Plz check location from maps, i.e. check what you have done fits.
When you ask a question that is actually answered in the documentation, you are either lazy or a moron.

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Re: Using LazToApk
« Reply #16 on: June 30, 2015, 10:51:37 am »
Open laztoapk in lazarus IDE and Debug! DetectInstalledNDKPlatforms
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Re: Using LazToApk
« Reply #17 on: June 30, 2015, 07:19:46 pm »
Did you debug and find out what's wrong? If so please let me know.
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Using LazToApk
« Reply #18 on: June 30, 2015, 07:23:22 pm »
Not yet. I made the big mistake of uninstalling LazToApk and am still reinstalling it.

I got the project from SourceForge, but it seems to be not up to date.
« Last Edit: June 30, 2015, 08:02:30 pm by typo »

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Re: Using LazToApk
« Reply #19 on: June 30, 2015, 08:28:17 pm »
Hello typo,

the sources at sourceforge.net are the latest sources. Why do you think it's not the correct source?
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Using LazToApk
« Reply #20 on: June 30, 2015, 08:39:02 pm »
I see at least 1 error on DetectInstalledNDKPlatforms: Pos never returns -1. Maybe it should be 0.

Code: [Select]
function TfrmApkManager.DetectInstalledNDKPlatforms: TStringList;
var
i:integer;
_pos:integer;
_temp:string;
_tempList:TStringList;
begin
  result:=TStringList.create;
  result:=FindAllFiles(FAndroidNDK,'libc.so');
  if result.count=0 then begin
    MessageDlg(format('No files with name <libc.so> found in NDK-path <%s>. Did you install the android NDK and setup the correct NDK-Path?',[FAndroidNDK]),mtWarning, [mbOK], 0);
    exit;
  end;
  _tempList:=TStringList.create;
  try
    _tempList.Duplicates:=dupIgnore;
    _tempList.sorted:=true;
    for i:=0 to result.count-1 do begin
      _pos:=pos('platforms\android-',result[i]);
      if _pos=-1 then continue;         //<<<<<<<<<<<
      _temp:=result[i];
      delete(_temp,1,_pos+17);
      _pos:=pos(PathDelim,_temp);
      _temp:=copy(_temp,1,_pos-1);
      _tempList.add(_temp);
    end;
    result.assign(_tempList);
  finally
    _tempList.free;
  end;
end;           

I think the error I have found is related to this, the folders shown in the list is all but from "platforms\android" folder, instead of the contrary. Maybe the only dirs which should be in this list are "platforms\android" and their subdirs.
« Last Edit: June 30, 2015, 08:58:01 pm by typo »

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Re: Using LazToApk
« Reply #21 on: June 30, 2015, 08:57:20 pm »
You are right Should be =0.
I will check if this error might be around somewhere else in the code and the update at sourceforge.
 
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Using LazToApk
« Reply #22 on: June 30, 2015, 09:04:08 pm »
Also, maybe this function can be simplified, at least because FindAllFiles has an overloaded one on which you can set a StringList as a parameter, avoiding memory leak.

Code: [Select]
procedure FindAllFiles(AList: TStrings; const SearchPath: String;
  SearchMask: String = ''; SearchSubDirs: Boolean = True; DirAttr: Word = faDirectory); overload;       

So you could write:
Code: [Select]
FindAllFiles(Result, ...

You should not create Result StringList because it is already created in FindAllFiles function.

Another issue I see is in the line:
Code: [Select]
delete(_temp,1,_pos+17);
Of course you refer to the string 'platforms\android-', which has in fact 18 chars. Use Length('platforms\android-').
« Last Edit: June 30, 2015, 09:33:16 pm by typo »

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Re: Using LazToApk
« Reply #23 on: June 30, 2015, 09:28:45 pm »
Ok, fixed and checked in the sources to sourceforge.net
But this was probably not the troublemaker for your problem. So if you could debug and find out I would be very glad.

Need to sleep now. Will be back tomorrow.
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Using LazToApk
« Reply #24 on: June 30, 2015, 09:39:01 pm »
Thanks for your work.

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Using LazToApk
« Reply #25 on: July 01, 2015, 02:41:48 pm »
Now I can debug the project, but my error has desapeared because you have changed it a bit.

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Re: Using LazToApk
« Reply #26 on: July 01, 2015, 07:02:15 pm »
Hello,

sorry I don't understand.
The fix about _pos=-1 did solve your problem?

Can you build now an app?

Regards,
Sam
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Using LazToApk
« Reply #27 on: July 01, 2015, 07:05:41 pm »
No.

On Step 4 an error occurs. The file does not exist.
« Last Edit: July 01, 2015, 07:12:45 pm by typo »

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Re: Using LazToApk
« Reply #28 on: July 01, 2015, 07:09:04 pm »
But you wrote that the error has disappeared.
So you have now another problem ?

If so, then please give some information about the problem or debug it yourself.
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 251
    • Fresh sound.
Re: Using LazToApk
« Reply #29 on: July 01, 2015, 07:18:44 pm »
Ok, please close lazarus and laztoapk.
Then delete the file laztoapk.ini.
Start laztoapk again.

It will try to rebuild lazarus.

Hope this helps.
Linux Mint 19.1, Lazarus 2.0, Windows 7&10, Delphi 7, Delphi 10.3 Rio

 

TinyPortal © 2005-2018