LAMW on Debian 10 with actual Android Studio lazarus / 43-Android ---------------------------------------------------------------------- af0815 · 2021-01-29 12:59 If i want to create a new project i get: -->> Messagebox with 'Fail! Folder /home/andi/Android/Sdk/ndk/22.0.7026061/platforms is empty! The message is correct, the directory platforms is not here. How can i get this working ? Way of working QuoteDebian 10 Buster *) apt - sudo apt install libx11-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev subversion git freeglut3-dev - sudo apt install gradle - sudo apt install ant *) fpcupdeluxe-x86_64-linux - fixes/fixes install - cross arm-android install - cross aarch64-android install *) Lazarus - OPM: LAMW - OPM: EyeCandyControls (ecccontrols) - OPM: HashLib (hashlib4pascalpackage) *) Androidstudio - Download from https://developer.android.com/studio (Button AndroidStudio 4.1.2 for 64 Bit) - move into homedir with a created data dir - Extract with tar -xvzf android-studio-ide-201.7042882-linux.tar.gz - ~/data/android-studio/bin/studio.sh -- configure (bottom) SDK Manager -- SDK Platforms --- Android 9.0 (Pie) -- SDK Tools --- NDK (side by side) --- Google Play services -- Follow the tips *) Lazarus LAMW - Tools LAMW -> Path settings -- PATH To Java JDK: /home/andi/data/android-studio/jre -- Path to Ant: /usr/bin/ant -- Path to Gradle: /usr/bin/gradle -- Path to Android NDK: /home/andi/Android/Sdk/ndk/22.0.7026061 -- NDK Version: >11 -- Path to Android SDK: /home/andi/Android/Sdk *) Lazarus Project create - Projekt -> New Project -- LAMW [GUI] Android module -- Gradl Version 4.4.1 (Ingo aus gradle -v) MsgBox see top of Post ---------------------------------------------------------------------- jmpessoa · 2021-01-29 13:39 Quote-- Path to Android SDK: /home/andi/Android/Sdk You can try change this to  Android Studio  path to sdk... ---------------------------------------------------------------------- af0815 · 2021-01-29 16:00 BTW: This is not a typo of mine. The path is realy /home/andi/Android/Sdk with a captial S. This is done by the installer of Android Studio. This is also seen in windows version too. ---------------------------------------------------------------------- af0815 · 2021-01-29 16:13 Quote from: af0815 on January 29, 2021, 05:00:42 pmBTW: This is not a typo of mine. The path is realy /home/andi/Android/Sdk with a captial S. This is done by the installer of Android Studio. This is also seen in windows version too. And the Sdk directory is empty Excactly the same on windows. The same error message. I think there is something changed in the structure of the Android Studio 4.1.2. ---------------------------------------------------------------------- jmpessoa · 2021-01-29 17:51 In Android Studio can try: "Tools" --> "SDK Manager" and check "Android API 30" and "OK" PS. Please,  can someone move this thread to "Android" ? ---------------------------------------------------------------------- af0815 · 2021-01-29 18:23 BTW: There is no Tools --> SDK Manager anymore In Android Stusdio 4.1.2 the is a Configure --> SDK Manager on the Bottomside Then Appeerance& Behavior->Syastem Settings->Android SDK --> SD Platforrms Android 11.0(R) API-Level 30 Revision 3 is installed and Android 9.0(Pie) API-Level 28 Revision 6 Android 5.1(Lollipop) API-Level 22 Revision 2  is  also installed. on SDK Tools Android SDK Build-Tools NDK (Side by Side) Android SDK Commanline Zools (latest) CMAKE Android Emulator Android SDK Platform-Tools Google Play services in ~/Android/Sdk/platforms there are 3 Platforms (android-30, android-22 and android-28) Edit: I have to correct one of my previos post,  ~/Android/Sdk/ is not empty.  In /home/andi/Android/Sdk/ndk/22.0.7026061 is no folder platform, as the Error Message state. ---------------------------------------------------------------------- jmpessoa · 2021-01-29 19:45 Well, you need a path like in picture ...  [Attachment] OR alternatively  from here: https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/LAMW_Ge tting_Started.txt Quote.Android SDK [old/recommended!] ---  "ant" and "gradle" build supported...    [recommended!!!]    [Windows]   https://dl.google.com/android/repository/tools_r25.2.5- windows.zip    [Linux]      https://dl.google.com/android/repository/tools_r25.2.5 -linux.zip    [Mac]      https://dl.google.com/android/repository/tools_r25.2.5- macosx.zip    Hint:          0)unpacked/install to a "sdk" folder       1)after unpacked/install, open a command line Terminal and go to folder "sdk/tools"       2)run the command  ">android update sdk"   to open a GUI "SDK Manager"       3)check "Android SDK Tools"       4)check "Android SDK Platform-Tools"             6)check "Android SDK Build-Tools 29.0.3"        8)go to "Android 10 (API 29)" and check only "SDK Platform"       9)go to "Extras" and check:             "Android Support Repository"                         "Android Support Library"                         "Google USB Drive"   //windows only...             "Google Repository"             "Google Play Services" Edited: googling I found this [for windows]: by default, the "Android Studio IDE" will be installed in "C:\Program Files\Android\Android Studio", and the "Android SDK" in    "c:\Users\username\AppData\Local\Android\Sdk". ---------------------------------------------------------------------- af0815 · 2021-01-29 21:23 my focus is on linux Debian 10. But i see it is not possible actual to use the last Android Studio, because something is different. Edit: It looks like the studio is downloading the ndk depending on the project. Maybe this is the reason why there is only a ndk-stub inside the Android folder. If you open a demo project in Android Studio, you have to wait a long and boring time, because the studio (gradle ?) load the ndk in the background. Quote29.01.21 22:00   Gradle sync started 22:10   Plugin Update Recommended: Android Gradle Plugin is ready to update. 22:10   * daemon not running; starting now at tcp:5037 22:10   * daemon started successfully 22:10   Gradle sync finished in 10 m 0 s 333 ms 22:11   NDK Resolution Outcome: Gradle model version=6.1.1, NDK version=21.2.6472646 But this ndk have no platform build inside. Interesting. I will have a look for this. ---------------------------------------------------------------------- af0815 · 2021-01-31 15:52 I have got a hint in the german forum. You have to use one special ndk version (side by side) 21.2.6472646 becaus the structure in newer version is changed. Now i can open the project, but problem arise with the finding of gradle. My grade, installed by debian ist in /usr/bin/gradle . which gradle tell me this path and gardle -v tells me Quote------------------------------------------------------------ Gradle 4.4.1 ------------------------------------------------------------ Build time:   2012-12-21 00:00:00 UTC Revision:     none Groovy:       2.4.16 Ant:          Apache Ant(TM) version 1.10.5 compiled on August 27 2018 JVM:          11.0.9.1 (Debian 11.0.9.1+1-post-Debian-1deb10u2) OS:           Linux 4.19.0-13-amd64 amd64 ant is also in this path QuoteApache Ant(TM) version 1.10.5 compiled on August 27 2018 If i insert in the LAMW 0.8.5 Path/settings the path to gradle with /usr/bin/gradle (and for ant /usr/bin/ant) i get the error on open a LAMW project QuoteVerbose: Please, wait... trying find Gradle version from Gradle [/usr/bin/gradle] Verbose: Sorry... Fail to find Gradle version from Gradle path ...and a Messagebox pops up: Executable not found: "/usr/bin/gradlebin/gradle" Press Ok..... it looks like the search for gradle is not good. If i set the path to /usr/ - the / is ignored and the path is /usrbin/gradle . Strange ---------------------------------------------------------------------- jmpessoa · 2021-01-31 16:50 For ant  /usr/bin/ maybe work... But for gradle LAMW wait a path like:  " /usr/bin/gradle-4.4.1"     [where the version is on...] What is content of your folder "gradle"    in the path  "/usr/bin/gradle"? Edited: about: QuoteVerbose: Please, wait... trying find Gradle version from Gradle [/usr/bin/gradle] Verbose: Sorry... Fail to find Gradle version from Gradle path ... Maybe you can help to fix "GetGradleVersionFromGradle"  in LAMW "....android_wizard\SmartDesigner.pas"  [line 1390] so, "/usr/bin/gradle" can work... PS. After fixed... re-install the "lazandroidwizardpack.lpk"  package... ---------------------------------------------------------------------- af0815 · 2021-01-31 18:45 I didnt found any problem in GetGradleVersionFromGradle BUT 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 TLamwSmartDesigner.GetGradleVersion(path: string): string;var  p: integer;  strAux: string;  posLastDelim: integer;begin  Result:='';  if path <> '' then  begin     path:= Copy(path,1, Length(path)-1);  //delete last pathDelimiter     posLastDelim:= LastDelimiter(PathDelim, path);     strAux:= Copy(path, posLastDelim+1, MaxInt);  //gradle-3.3 Here is the correct path delimiter killed AND 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 TLamwSmartDesigner.GetGradleVersionFromGradle(path: string): string;var   Proc: TProcess;   CharBuffer: array [0..511] of char;   p, ReadCount: integer;   strExt, strTemp: string;begin    Result:='';    if path = '' then Exit;    strExt:= '';    {$IFDEF WINDOWS}    strExt:= '.bat';    {$ENDIF}     //FillChar(CharBuffer,SizeOf(CharBuffer),#0);    try      Proc := TProcess.Create(nil);      Proc.Options := [poUsePipes];      //Proc.Options:= Proc.Options + [poWaitOnExit];      Proc.Parameters.Add('-v');      Proc.Executable:= path + 'bin' + pathDelim + 'gradle'+strExt;      IDEMessagesWindow.AddCustomMessage(mluVerbose, 'Info...Gradle Path: ' + Proc.Executable); The path is built without a valid delimiter. This is the reason for the broken path. I am not able to fix this, because i didnt know, why you decide not to build a valid path ? ---------------------------------------------------------------------- jmpessoa · 2021-01-31 19:37 You sugestion: 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 Proc.Executable:= path + 'bin' + pathDelim + 'gradle'+strExt;  Work for you? Can you get the gradle version? ---------------------------------------------------------------------- af0815 · 2021-01-31 21:00 No it works not, because the calling routine is removing the trailing backslash. I think you have removed this for a good reason, but i dont understand why ? IMHO must be a pathdelimiter before the 'bin', this should be true on linux. But i think a hardcoded 'bin' can be a handicap too. I have not fixed anything, i made only the path visible on a interesting point. One fix can be a fallback if the try is not ok, to combine the path in a other way. ---------------------------------------------------------------------- jmpessoa · 2021-01-31 21:13 QuoteOne fix can be a fallback if the try is not ok, to combine the path in a other way. But you can try some fix in your LAMW system.... so we can learn something about the error... ---------------------------------------------------------------------- af0815 · 2021-02-01 10:29 With this fix, the old behavior is presaved and new behavior is added. I have to test this more. A goo idea is, to test gradle first by hand. Because it is possible to get errors from gradle, if something is misconfigured. And the you also get no version information. a call to gradle have to give a good result in the terminal/commandline first. 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 TLamwSmartDesigner.GetGradleVersionFromGradle(path: string): string;var   Proc: TProcess;   FN: string;   CharBuffer: array [0..511] of char;   p, ReadCount: integer;   strExt, strTemp: string;begin    Result:='';    if path = '' then Exit;    strExt:= '';    {$IFDEF WINDOWS}    strExt:= '.bat';    {$ENDIF}     //FillChar(CharBuffer,SizeOf(CharBuffer),#0);    try      Proc := TProcess.Create(nil);      Proc.Options := [poUsePipes];      //Proc.Options:= Proc.Options + [poWaitOnExit];      Proc.Parameters.Add('-v');      FN:= AppendPathDelim(path) + 'gradle' + strExt;      if not FileExistsUTF8(FN) then begin        FN:= AppendPathDelim(path) + 'bin' + pathDelim + 'gradle' + strExt;        if not FileExistsUTF8(FN) then begin          FN:= path + 'bin' + pathDelim + 'gradle' + strExt;        end;      end;      Proc.Executable:= FN;      IDEMessagesWindow.AddCustomMessage(mluVerbose, 'Info...Used expanded Gradle Path: ' + Proc.Executable);      Proc.Execute();      while (Proc.Running) or (Proc.Output.NumBytesAvailable > 0) or        (Proc.Stderr.NumBytesAvailable > 0) do      begin        // read stdout and write to our stdout        while Proc.Output.NumBytesAvailable > 0 do        begin          ReadCount := Min(512, Proc.Output.NumBytesAvailable); //Read up to buffer, not more          Proc.Output.Read(CharBuffer, ReadCount);          strTemp:= Copy(CharBuffer, 0, ReadCount);          if Pos('Gradle', strTemp) > 0 then          begin             Result:= Trim(strTemp);           break;          end;        end;        {        // read stderr and write to our stderr        while Proc.Stderr.NumBytesAvailable > 0 do        begin          ReadCount := Min(512, Proc.Stderr.NumBytesAvailable); //Read up to buffer, not more          Proc.Stderr.Read(CharBuffer, ReadCount);          Lines2.Append(Copy(CharBuffer, 0, ReadCount));        end;        }      application.ProcessMessages;        //Sleep(200);      end;      ExitCode := Proc.ExitStatus;    finally      Proc.Free;       if Result <> '' then      begin        p:= Pos(' ', Result);  //Gradle 3.3        Result:= Copy(Result, p+1, MaxInt); //3.3        IDEMessagesWindow.AddCustomMessage(mluVerbose, 'Success!! Found Gradle version: ' + Result);      end      else        IDEMessagesWindow.AddCustomMessage(mluVerbose, 'Sorry... Fail to find Gradle version from Gradle path ... Reason:'+ strTemp);     end;end; ---------------------------------------------------------------------- jmpessoa · 2021-02-01 16:51 I will commit your code.... Thank you! ---------------------------------------------------------------------- af0815 · 2021-02-01 17:38 On Debian 10 (and Windows) grandle is now found and idetified correct as 4.4.1. I was able to compile a project with the new Android studio. Now i hang on more 'normal' problems. But this is another story. But i have seen, the problem with the grandle path is more complex, because the path to gandle is used often.