GithubHelp home page GithubHelp logo

jmpessoa / lazandroidmodulewizard Goto Github PK

View Code? Open in Web Editor NEW
236.0 236.0 82.0 273.36 MB

LAMW: Lazarus Android Module Wizard: Form Designer and Components development model!

Pascal 69.63% Java 30.29% Kotlin 0.07%

lazandroidmodulewizard's Introduction

N|Solid

LAMW: Lazarus Android Module Wizard

RAD Android! Form Designer and Components Development Model!
  • LAMW is a wizard to create JNI Android loadable module (.so) and Android Apk using Lazarus/Free Pascal.

Version

Features
  • Native Android GUI
    • AppCompat and Material Design supported!
  • RAD! Form designer and drag&drop component development model!
    • More than 150 components!

1. Get Lazarus for Android

  • Option a) Laz4Android 2.2.2 (Windows)

    • All cross-android compilers already installed!
      • arm-android/aarch64-android/i386-android/x86_64-android/jvm-android
      • hint: Install here: "C:\laz4android2.2.2" (not "Program Files" !!!)
    • How to:
      • Install Laz4Android2.2.2
      • Install LAMW
        • Download LAMW and unzip it in some folder
          • recommended folder: "C:\laz4android2.2.2\components"
        • Packages installations order/sequence:
          • tfpandroidbridge_pack.lpk (in "..../android_bridges" folder)
          • lazandroidwizardpack.lpk (in ""..../android_wizard" folder)
          • amw_ide_tools.lpk (in "..../ide_tools" folder)
      • Go to "2. Infrastructure Setup".
  • Option b) LAMW Manager

  • Option c) Fpcupdeluxe (Linux and Windows)

  • Option d) How to: Do It Yourself!

    • d.1) Get Lazarus2.x.y
    • d.2) Install LAMW
      • Download LAMW and unzip it in some folder
        • recommended folder "C:\lazarus2.x.y\components"
      • Packages installations order/sequence:
        • tfpandroidbridge_pack.lpk (in "..../android_bridges" folder)
        • lazandroidwizardpack.lpk (in ""..../android_wizard" folder)
        • amw_ide_tools.lpk (in "..../ide_tools" folder)
    • d.3) Get FPC source code (trunk):
      • Unzip it in some folder and point up the source path in step "d.4"
    • d.4) Go to Lazarus menu "Tools" --> "[LAMW] Android Module Wizard" --> "Build FPC Cross Android" and repeat the "Build and install" process once for each architecture.
      • (x) Armv7a + Soft (android 32 bits <<-- tested!)

        • Build
        • Install
      • (x) Aarch64 (android 64 bits <<-- tested!)

        • Build
        • Install
      • hint: After "build" and "install" the cross-compilers and after to do all "2. Infrastructure" go to "3. Using LAMW" and try to create your first [New] LAMW project!

      • If you get an error "Fatal: Cannot find unit system used by fcllaz of package FCL." when trying "Run" --> "Build" your project then go to "fpc.cfg" (ex. "C:\lazarus2.x.y\fpc\3.2.2\bin") and:

        • change:
                  #searchpath for units and other system dependent things
                  -FuC:\lazarus2.x.y\fpc\$FPCVERSION/units/$fpctarget 
                  -FuC:\lazarus2.x.y\fpc\$FPCVERSION/units/$fpctarget/*  
                  -FuC:\lazarus2.x.y\fpc\$FPCVERSION/units/$fpctarget/rtl
        • to:
                 #searchpath for units and other system dependent things
                 -FuC:\lazarus2.x.y\fpc\3.2.2/units/$fpctarget 
                 -FuC:\lazarus2.x.y\fpc\3.2.2/units/$fpctarget/*  
                 -FuC:\lazarus2.x.y\fpc\3.2.2/units/$fpctarget/rtl
        • and go to Lazarus IDE menu "Tools" -> "Options" -> "Environment"
          • "FPC Source"
            • change:
                      $(LazarusDir)fpc\$(FPCVer)\source 
            • to:
                      $(LazarusDir)fpc\3.2.2\source

2. Infrastructure Setup :: only for non-users of "LAMW Manager" !!

2.1 Get Java JDK and Gradle system Apk builder
  • recommended: Java JDK 21 + Gradle version >= 8.5
  • recommended: Java JDK 17 + Gradle version >= 8.1.1
  • deprecated: Java JDK 11 + Gradle version >= 6.7.1
  • minimalist alternative: Java JDK 1.8 + Gradle version <= 6.7
    • JDK 1.8 support the limited but light Ant system Apk build
2.2 Get Android SDK
  • recommended: supporting JDK 21 + Gradle version >= 8.5

  • how To:

    • unpacked command line tools ".zip" to a "temporary" folder
    • create a directory tree like: C:\android\sdkJ21\cmdline-tools\latest
    • Copy all content from "temporary" folder to exactly "...\sdkJ21\cmdline-tools\latest"
    • Open a terminal or cmd and go to "...\sdkJ21\cmdline-tools\latest\bin"
      • run the command >> sdkmanager "build-tools;34.0.0" "platforms;android-34" "platform-tools"
      • hint: you can get others android components by sdkmanager...
  • recommended: supporting JDK 17 + Gradle version >= 8.1.1

  • how To:

    • unpacked command line tools ".zip" to a "temporary" folder
    • create a directory tree like: C:\android\sdkJ17\cmdline-tools\latest
    • Copy all content from "temporary" folder to exactly "...\sdkJ17\cmdline-tools\latest"
    • Open a terminal or cmd and go to "...\sdkJ17\cmdline-tools\latest\bin"
      • run the command >> sdkmanager "build-tools;33.0.2" "platforms;android-34" "platform-tools"
      • hint: you can get others android components by sdkmanager...
  • deprecated: supporting JDK 11 + Gradle version >= 6.7.1

  • how To:

    • unpacked command line tools ".zip" to a "temporary" folder
    • create a directory tree like: C:\android\sdkJ11\cmdline-tools\latest
    • Copy all content from "temporary" folder to exactly "...\sdkJ11\cmdline-tools\latest"
    • Open a terminal or cmd and go to "...\sdkJ11\cmdline-tools\latest\bin"
      • run the command >> sdkmanager "build-tools;33.0.2" "platforms;android-33" "platform-tools"
      • hint: you can get others android components by sdkmanager...
  • minimalist alternative: supporting JDK 1.8 + limited but light Ant system Apk build + Gradle <= 6.7

  • how to:

    • unpacked/install the ".zip" file to a folder like "sdkJ1.8"
    • open a command line terminal or cmd and go to folder the "sdkJ1.8\tools"
    • run the command >>android update sdk //to open a GUI SDK Manager
      • go to Tools and keep as is
        • Android SDK Tools (installed)
        • (x) Android SDK Platform-Tools
        • (x) Android SDK Build-Tools 29.0.3 (and others more recent)
      • go to Android R and uncheck all!
      • go to Android 10 API 29 uncheck all and check only
        • (x)SDK Platform
      • go to Extras and check:
        • (x)Android Support Repository
        • (x)Google USB Drive (Windows only...)
        • (x)Google Repository
        • (x)Google Play Services
      • Install 7 or up package!
    • IMPORTANT: on command line terminal or cmd go to folder "sdkJ1.8\tools\bin"
      • run the command >>sdkmanager --update
      • run the command >>sdkmanager "build-tools;30.0.2" "platforms;android-33"
    • IMPORTANT: build-tools = 30.0.3 is the maximum supported in this setup!
2.3 Get Android NDK
  • recommended version
2.4 Get Ant builder
  • Simply extract the zip file to a convenient location...
2.5 Get Gradle builder
  • recommended versions
    • Java JDK 21: Gradle 8.5 or up
    • Java JDK 17: Gradle 8.2.1 or up
    • Java JDK 11: Gradle 7.6.3 or up
    • Java JDK 1.8: Gradle 6.7 or down
      • Use the option "extract here" to produce the folder "gradle-x.y.z" in a convenient location...
      • warning: Gradle build process need internet connection!!!

3. Using LAMW

  • 3.1) Configure Paths:
    • Lazarus IDE menu "Tools" -> "[LAMW] Android Module Wizard" -> "Paths Settings ..."
      • hint: [MacOs >= 10.5] Path to Java JDK auto setting as: ${/usr/libexec/java_home}
  • 3.2) How to: Create and Run your first Android Apk!
    • 3.2.1) From Lazarus IDE select "Project" -> "New Project"
    • 3.2.2) From displayed dialog select "[LAMW] GUI Android Module" and "Ok"
    • 3.2.3) Fill the displayed form fields and "Ok" and "Save"
      • hint: "Path to Workspace" is your projects folder!
      • hint: Accept "default" options! (but pay attention to the * signage)
      • hint: search your project folder... you will find many treasures there! (look for lazarus project in ".../jni" folder)
    • 3.2.4) From Lazarus IDE select "Run" -> "Build"
      • Success! Your sistem is up to produce your first Android Apk!
    • 3.2.5) Configure you phone device to debug mode/developer options and plug it to the computer usb port
    • 3.2.6) From Lazarus IDE select "Run" -> "[LAMW] Build Apk and Run"
      • Congratulations! You are now an Android Developer!

4. Others References

N|Solid

lazandroidmodulewizard's People

Contributors

bogomolov-a-a avatar chacalfloripa avatar codereamp avatar cpicanco avatar dosza avatar elera avatar guaracy avatar insid3codeteam avatar jmpessoa avatar kryslt avatar leopreo avatar longdirtyanimalf avatar luciantodor avatar marcos-ebm avatar nenirey avatar neurocluster avatar odisey1245 avatar r1me avatar renabor avatar soinalastudio avatar tintinux avatar tmorohe avatar tomaszkami avatar tr3esoftware avatar waynesherman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lazandroidmodulewizard's Issues

Exception "Unknown property: DesingTimePPI"

hi all,
I get this Exception when I click the menus in Tools >> [LAMW] Android Module Wizard >> Paths settings for example or another submenu in the same level.
How to remove it please?
I use Laz4Android with Lazarus 1.7 and the Latest version of LAMW from git.

Thank you.
capture

error while compiling app text to speech demo

When I have tried to compile
AppActionBarTabDemo1
everything was OK. But when I have tried to compile Text to speech demo, I have got series of errors while compiling with javac. I have attached The file.

LAMW with JSON

Hey guys, I think i discovered a bug in LAMW. Whenever I try to retrieve data from a JSON object, the application crashes, and I receive the following message from logcat:

A/libc(30743): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

I can do almost anything with a JSON object, and the application goes on. But when I try to access the fields of my JSON objects, one of the most crucial things within the application, the crash happens.

I don't know the reason yet, but I think the problem may be general for all LAMW users. Because of that, I've made a smaller application that reproduces the error, here is the unit for it:

unit testgui;

{$mode delphi}

interface

uses
  Classes, SysUtils, And_jni, And_jni_Bridge, Laz_And_Controls, 
    Laz_And_Controls_Events, AndroidWidget, fpjson, jsonparser, fpjsonrtti;

type

  TMyObj = class
    id:Integer;
    name:String;
    val:Real;
  end;

  { TAndroidModule1 }

  TAndroidModule1 = class(jForm)
    jButton1: jButton;
    jListView1: jListView;
    procedure jButton1Click(Sender: TObject);
  private
    {private declarations}
  public
    {public declarations}
  end;

const
  json = '[{"id":1,"name":"first","val":2.5},{"id":2,"name":"second","val":3.5},{"id":3,"name":"third","val":4.5}]';

var
  AndroidModule1: TAndroidModule1;

implementation

{$R *.lfm}

{ TAndroidModule1 }

procedure TAndroidModule1.jButton1Click(Sender: TObject);
var
  vja: TJSONArray;
  vjo: TJSONObject;
  vobj: TObject;
  vmyo: TMyObj;
  vdst: TJSONDeStreamer;
  i: Integer;
  s: String;
begin
  try
    try
      vdst:= TJSONDeStreamer.Create(nil);
      vdst.CaseInsensitive:= true;
      vmyo:= TMyObj.Create;
      vja:= TJSONArray(GetJSON(json));
      vjo:= vja.Objects[0];
      ShowMessage(vjo.AsJSON);
      ShowMessage('== If this is shown, then phase 1 is fine ==');
      vdst.JSONToObject(vjo,vobj);
      vmyo:= vobj as TMyObj;
      ShowMessage('== If this is shown, then phase 2 is fine ==');
    except

    end;
  finally

  end;
end;

end.

syntax error in ide_tools/uformsettingspaths.pas (Linux)

Master branch, file "ide_tools/uformsettingspaths.pas" does not compile on Linux.

Please remove semicolon at end of Line 317:
if Self.FPrebuildOSYS <> '' then;

and remove semicolon before "else" at end of line 318:
ComboBoxPrebuild.Text:= FPrebuildOSYS;

jBluetoothClientSocket

Here's the deal, I'm using the Bluetooth components in a demo application, which will serve as the foundation of a bigger application, which may turned into a commercial application in the future(who knows). Everything was OK, I was able enable the Bluetooth of the device, search for paired devices on the vicinity, and connect to one of the devices. But was after that where the problems started to begin.

First: the application was unable to disconnect from the other device using jBluetoothClientSocket.Disconnect(). I assured that a device should be connected before calling this method, and set the application to inform the user if connection was terminated. But after the call, the other device keep telling me that the connection was active, and due the nature of Bluetooth, this shouldn't be true if the method was successful.

Second:The other device didn't received data sent from the application using jBluetoothClientSocket.Write(), and the application was able to retrieve the data using jBluetoothClientSocket.Read either. And I also had ways to assure and measure if the other device had sent or received data.

I don't know if I'm misusing the components, but they seemed intuitive, so I worked with what I had. But I'm certainly misguided, because LAMW has little to no documentation, and that may had been the cause of these inconsistencies.

Thank you in advance for any help.

jLocation doesn't work if GPS was not enabled at startup

If GPS was initially (before starting the app) disabled, then jLocation will never call back with phone location nor GPS status / satellites.

How to reproduce with AppLocationDemo1 demo:

  1. Close apps, disable GPS.
  2. Start AppLocationDemo1 (don't press any button)
  3. Enable GPS in phone Settings.
  4. Press 'Try Start Tracker' button in demo app.
  5. The app will return a message 'GPS is On! Starting Tracker...' but will never call any of the jLocation events.

Android 7.1.2

error while compiling Alarm manager sample app

Finally here is detailed log about compilation. I AM helpless to find The cause myself. I have installed all SDK platform tools needed, including Android API 17. Unfortunately, more than 1 or 2 sample projects can not be compiled. I Am also using ANDROID NDK R10E. Or should I use lover supported version instead?
I know, that I AM bothering you but I can not find The cause myself even by reading log carefully.

loading video and audio from Internet native assertion crashes

Dear specialists,
I AM running latest stable laz4android. I Am running latest available lazandroidmodulewizard-master branch. When I want to try yours provided sample demo load image and video from Internet, I Am occurring native crashes and Java virtual machine exception. Here is one bug produced by Java virtual machine. When i want to switch from one live stream to other.
09-03 12:54:37.968: A/art(8581): art/runtime/java_vm_ext.cc:440] JNI DETECTED ERROR IN APPLICATION: thread Thread[18,tid=8656,Native,Thread*=0xb92756c0,peer=0x12d40fa0,"AsyncTask #2"] using JNIEnv* from thread Thread[18,tid=8656,Native,Thread*=0xb92756c0,peer=0x12d40fa0,"AsyncTask #2"]

And one of The clean C native crash.
09-02 15:05:58.555: A/libc(31960): Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 32005 (AsyncTask #1)
I AM visually impaired with no sight at all. But I Am very nicely impressed by yours project. It reduces number of .pas source code lines, which developer must write to use yours development model and GUI interface.
I want to help you debugging. If I can help you debugging, please give me some instructions.
Please also be aware, that build in modern Samsung mobile phone energy saving feature prevent yours background function to run if USB charger have been disconnected from The phone. So Internet radio play stop when screen have been turned off by using power button and if charger is not connected. I Am suggest you to use wakelock feature. And unfortunately, Yours sample based on component to play video or sound from The internet can not be used on Android 4.1.2.
Any instructions, advices are very welcomed.
I want to help you.

FTP component Please.

Hi, this is a question. I strongly need a feature, to upload a file, ftp. or any other idea for sharing a high score .txt file, or a sqlite db with my server... this would be great! Thanks a lot!

Lazarus on Ubuntu 14.04 64: java.lang.NoClassDefFoundError

Some components are giving this issue: java.lang.NoClassDefFoundError

W/dalvikvm( 1714): JNI WARNING: JNI method called with exception pending
W/dalvikvm( 1714): in Lorg/deskx/an1/Controls;.pAppOnCreate:(Landroid/content/Context;Landroid/widget/RelativeLayout;)V (NewGlobalRef)
W/dalvikvm( 1714): Pending exception is:
I/dalvikvm( 1714): java.lang.NoClassDefFoundError: org.deskx.an1.jPanel
I/dalvikvm( 1714): at org.deskx.an1.Controls.jPanel_Create(Controls.java:10177)

customlistviewrow file

Hi jmpessoa.

Laz_And_Controls file, row 1446, customlistviewrow unit is not present.

Thanks.

version 0.8 can't find SDK build-tools folder on Linux

My SDK path is "/home/user/android/sdk"

android_wizard/androidwizard_intf.pas line 742 removes paths with "android" in them which filters out my path:

742: if ( Pos('W', auxStr) = 0 ) and ( Pos('rc2', auxStr) = 0 ) and (Pos('android', auxStr) = 0 ) then //escape some alien...

Project Options / Application / Title is disabled !

Hi ! In New release of LAMW the "Title" EditBox is disabled. Please change in androidprojoptions.lfm and in line 286 in component "object edLabel: TEdit", the enabled property from False to True.

  object edLabel: TEdit
    AnchorSideLeft.Control = cbTheme
    AnchorSideTop.Control = tsAppl
    Left = 59
    Height = 28
    Top = 6
    Width = 350
    BorderSpacing.Top = 6
    Enabled = True <<---------------  Is False !
    TabOrder = 1
  end

Thank you and Best Regards - Freris

[LAMW] Build and Run

Exactly this is not issue but a suggestion. When I build LAMW project it's run automaticaly on virtual device. Due to the limited resource of my komputer, so I need build only and not run. Here I make a little modification code at "...\lamw\ide_tools\amw_ide_menu_items.pas as bellow:

procedureBuildApkAndRun(Sender: TObject);
var
Project: TLazProject;
begin
Project := LazarusIDE.ActiveProject;
if Assigned(Project) and (Project.CustomData.Values['LAMW'] <> '') then
try
IDEMessagesWindow.BringToFront;
with TApkBuilder.Create(Project) do
try
if LazarusIDE.DoBuildProject(crRun, []) <> mrOk then
raise Exception.Create('Cannot build project');
if BuildAPK then
begin
// Little modification to have a chance
if MessageDlg('RUN', 'Run Android Apps (APK).?' +
sLineBreak + 'Make sure your android virtual device running on your computer',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then**
RunAPK;
end;
finally
Free;
end;
except
on e: Exception do
IDEMessagesWindow.SelectMsgLine(
IDEMessagesWindow.AddCustomMessage(mluFatal, '[' +
e.ClassName + '] Failed: ' + e.Message, '', 0, 0, 'Exception'));
end
else
ShowMessage('The active project is not LAMW project!');
end;

I'm sorry if this is wrong place. I don't know how to request this suggestion.
Thank you.

¨Speech to text unit issue

I have tested Speech to text and I have found out very interesting fact.
When I have declared Input variable as Unicodestring
The line of code
Input := jSpeechToText1.SpeakOut(intentData);
Return always only one word. So even if I have spoken more than one words, this variable contain only one word.
Is it possible to store more than one words after using
Input := jSpeechToText1.SpeakOut(intentData);
Or it is internal issue of Android, that it is not possible to find better way for words storage inside variables? Or do I had to use other variable type not Unicodestring?
Because I must test The recognized result in if then condition blocks.
Thank you very much for yours help and support.

jShellCommand

I tried to make my own example here using jShellCommand and nothing. The application builds and installs all right, but when it tries to run, a white screen appears and a warning from android, saying that the application has stopped working, just remove this component of the application that it works right, does anyone could tell me why this happens?

some advices how to create forms without using form designer

Because you are very friendly and highly hard working developers, who do their best to make this project working, I have one constructive plea to you.
I have found out, that I can not really use Form designer to create forms. FPCJVM compiler lack support of Pointers when calling .so native C libraries, so it is also not good way to make good app which calls .so libraries. And Lamw projects compile many .pas sources directly to machine processor code so speed is much more faster. So I have first plea.
How to correctly specify The object ID when creating .lfm file?
Can I simply specify ID from 1 to 20?
Currently I have found out, that I can remove objects from forms from Lazarus IDE, but for example, I can not change text values of objects on A form. So I mostly use Akelpad text editor to work with forms.
I will try to make a collection of all possible objects types and I will create for example button.lfm, combobox.lfm files to have prepared all possible Lamw compatible Object types.
I will try to use copy and paste operations to build my .lfm form.
And commands in .lfm file
BackgroundColor = colbrDefault
Which values can be put instead of default? It is necessary to type Hexadecimal colour numbers? Or it would be possible to allow developers to simply type colour Adjectives and optional number values?
Such as red, blue, white, and other colour names.
Thank you very much for yours time and for yours answers.

Console apps should be accessible with Talkback

Whe have professional solution, which is capable to create nicely looked applications. But why console applications which uses commands such as writeln or readln can not be made accessible also with Talkback?
So also those apps would be compiled to standard.apk file and could be also executed from a Android launcher such as GUI apps.
I only do not know, if is it technically possible. How much programmers efford would it require to achieve this task.

How to integrate Android support to The Lazarus 2.0 32 bit package?

Would somebody of us give not only Me step by step instructions how to integrate Android support to Lazarus 2.0 so also Lamw will work correctly? Now, I AM getting error when I want to use Lamw create package command by pressing CTRL+F1.
What would I had to do to get Lamw and also Android work by using Lazarus 2.0? I have even tried to use Lamw commands
Get FPC Source [Trunk]
Build FPC Cross Android
But I have got errors after compilation related to Lazarus packages. So what should I do?

gradle_local_build.sh and gradle_local_run.sh don't work (linux)

android_wizard/androidwizard_intf.pas line 2088 and 2101 have a .\ in front of gradle which prevent it from running:

2088: strList.Add('.\gradle clean build --info');
2101: strList.Add('.\gradle run');

Since gradle is in the path, when I remove the .\ it works.

Bug while opening controls.lpi as project

When ever I want to open controls.lpi from every demo sample folder, I Am getting this bug.
"an" is an invalid integer.
Press OK to ignore and risk data corruption.
Press Abort to kill the program.
OK, storno.
When I press OK, there is no issue. I can create .apk package and resulting app is running on Android device like a charm. May be, that this little bug could be fetched as non remarkable. Or do you think, that it would be good idea to think about it?
My configuration.
Windows 10 Home premium 64 bit.
Installed Java configuration.
JRE
Java 8 Update 161
Java SE Development Kit 8 Update 60
Lazarus Used

laz4android1.8.0-FPC3.0.4.
Thank you for yours programmers analysis of this little issue.
May be, that it is caused by something inside my Windows, I do not know.

System.ChDir should not be used

ChDir blocks directory by Lazarus (it cannot be removed etc.)
If ChDir is used only for check directory existence, it should be replaced by DirectoryExists(Utf8).
Maybe commenting out androidwizard_intf.pas:1470?

Layout library for visually impaired programmers

How complex would be to create Pascal Unit, which would be used to create APP GUI without specifiy pixel values?
How complex would be to create algorithm, which would try to position objects automatically?

How to store data from voice recognition to string variable?

I have decided to bypass GUI creation by simply using voice recognition engine. But I Am helpless to find The way how to test which string have been stored to some variable.
I do not know how to convert data stored in The variable type jObject);
Showmessage write out recognized text but I need to have this text stored in some variable, where I can make congition blocks to test The content of this variable so program will be able to perform AN actions according to recognized value from VOice recognition engine from Google.
But how to do that? If it is currently not possible, please try to consider adding some function or procedure, which will support also string variables or other data type, which can be used inside condition blocks.

jSpeechToText1.SpeakOut(input);
But which data type should I assign to input variable, because when I construct this command, It support only pointer variable data type.

Copy&paste does not assign new IDs

When copying eg. jEditText its ID (visible in lfm) does not change. This is a bug because then Anchor based sizing and positioning does not work as expected.

Quick fix: Make ID visible in object inspector to change it manually.
Better fix: Generate new ID when copied. Then traverse all controls and ensure they have unique ID.

jForm fixed size

Why the size of jForm is fixed (hardcoded as 300x600, see androidwidget.pas:1819-1823)?

Build in Lazarus / Gradle Linux "--info"

Ubuntu 16.04 / x64. Lazarus 2.0.2, FPC 3.0.4.

2 issues.

  1. Can't parse "--info" of gradle clean build --info. I worked around it by commenting out --info as a param in apkbuild.pas.

  2. Sans --info param though gradle does not try to build in the Project Directory. The terminal pops up, runs gradle, completes 1 task and exits.

A couple of suggestions. Is there any reason gradle isn't used for the entire build process? I also want to mention that a lot of the sh scripts will not work. Ubuntu defaults to dash not bash. Shebang line would help but even something as simple as source in this these scripts needs to be . not source command. The paths are wrong as well. Simple scripts such as install debug apk have the wrong path to the apk.

I have one script in .local/bin

that will do the same

#!/usr/bin/env bash

debug_apk_dir=$(pwd)/build/outputs/apk/debug/
debug_apk=$(find $debug_apk_dir -name "*.apk")

adb install -r $debug_apk

Despite that. Thank you for the great work. I build the APK on the CLI without issue. It would be nice to build in the IDE though.

AudioRecord example

Can someone please provide a simple AudioRecord binding / example?

Many thanx in advance!

Application crash

Hi, while I was developing an application, I've tried to implement a exception handler that writes a log file whenever an unhandled exception is raised, such file should contain the information of the exception. The code for the handler his like this:

function DumpExceptionCallStack(E: Exception): string;
var
  I: Integer;
  Frames: PPointer;
  Report: string;
begin
  Report := 'Program exception! ' + LineEnding +
    'Stacktrace:' + LineEnding + LineEnding;
  if E <> nil then begin
    Report := Report + 'Exception class: ' + E.ClassName + LineEnding +
    'Message: ' + E.Message + LineEnding;
  end;
  Report := Report + BackTraceStrFunc(ExceptAddr);
  Frames := ExceptFrames;
  for I := 0 to ExceptFrameCount - 1 do
    Report := Report + LineEnding + BackTraceStrFunc(Frames[I]);
  result := Report;
end;  

procedure TAndroidModule1.CustomExceptionHandler(Sender: TObject; E: Exception);
var
  s,z: String;
begin
  s:= DumpExceptionCallStack(E);
  z:= FormatDateTime('dd_mm_yy__hh_nn_ss',Now);
  jTextFileManager1.SaveToFile(s,'log_'+z+'.txt');
  Self.CopyFile(Self.GetEnvironmentDirectoryPath(dirInternalAppStorage)+'/log_'+z+'.txt',
                Self.GetEnvironmentDirectoryPath(dirDownloads)+'/log_'+z+'.txt');
end;   

And also, to make the application use this handler, I've done this:

gApp.OnException:= TAndroidModule1.CustomExceptionHandler;

The CustomExceptionHandler works fine when I call it, creating and writing a log file for an exception that I have passed, but when I do this:

procedure TAndroidModule1.jButton1Click(Sender: TObject);
begin
  raise Exception.Create('Testando exceção');
  //CustomExceptionHandler(Sender,Exception.Create('Testando exceção')); //works fine
end; 

the application crashes and no log file is written nor created. What should be the reason of this?

Designer

I'm going to change default color of jForm to (R:240,G:240,B:240), that is default for Android 4.2.2 (api17). Why it is black? Draft classes should be also reworked for white background drawing.
Any objections?

Error using special characters

Error using special characters ... with accents.

example:
   Computer error occurs
  Informatica in error

how can I get around this error?

Tanks

Cristiano

Is it possible to load and use .so library in Lamw projects on Android 4.1.2?

Dear specialists,
I have worked with one older Lamw based project. Its aim was to provide simple Internet radio player, which have used bass.so for Android.
Project is still working smoothly on modern devices, but it is not possible to use bass.so on older devices. Developer of bass.so have confirmed Me, that his library should even work with lover versions of Android than 4.1.2. And here is The core of my question.
Is it possible to call and use other .so libraries when using Lamw project on Android 4.1.2? Do you think, that it would be necessary to modify Lamw modules so some hack had to be done to support Android 4.1.2 while using .so libraryes?
To test it. Does somebody of you know about some Lamw compatible project, which uses at least one .so library so I could try it with Android 4.1.2?
I Am getting this bug when I want to use bass.so on Android 4.1.2 and I have done my best to use Lamw from yesterday. I had to combine two various versions of Lamw and two various versions of Lazandroid to be successfull and I had to type
ant release
command after use build command to be able to compile My project with latest Lamw. Sure, app is working on modern devices. But still crash perssists on Android 4.1.2
Here is bug
I/DEBUG ( 1252): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
And here is one favourite little Radio player which I have compiled on Lazandroid latest stable by using Lamw version 0.8.3

https://github.com/r1me/LAMWBassStreamPlayback
Sure, I have also incorporated latest stable bass.so for Android. And thank you again. My sighted mother have told Me, that GUI which have created by Lamw are very attractive. Form based GUIS are containing nice frames. Very well done.

Project name can be changed only for once

I have found one interesting property of Lamw modules.
When I use project options dialog window, when I choose Lamw dialog, there is one editable field, which can be used to change project name. After changing its name, I press OK, and save all button. Project is correctly stored. But when I open controls.lpy, I can not change project name for The second time. I do not know, if is it cause because of The fact,that it is necessary to change some binary data files. It is only very little issue, but I have discovered it.

[Lamw] Build Android Apk and Run - ant build error

Hi!
After update to last Lamw Ver. 0.7 rev. 22-21 lazandroidmodulewizard, when create simplest App, (laz4android 1.7.0)
I starting get this errors:

Messages, Hints: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: E:\lamw\projects\tests\lamw_hello_25_10_17\libs\armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Duplicate unit "controls" in "controls", orphaned ppu "E:\lamw\projects\tests\lamw_hello_25_10_17\obj\controls\controls.o"
Note: Duplicate unit "controls" in "LCLBase 1.7", ppu="E:\lamw\laz4android\lcl\units\arm-android\controls.ppu", source="E:\lamw\laz4android\lcl\controls.pp"
Compile Project, OS: android, CPU: arm, Target: E:\lamw\projects\tests\lamw_hello_25_10_17\libs\armeabi-v7a\libcontrols.so: Success
Building APK... : Exit code 1, Errors: 84
Panic: Buildfile: E:\lamw\projects\tests\lamw_hello_25_10_17\build.xml
Panic:      [copy] Copying 4 files to E:\lamw\projects\tests\lamw_hello_25_10_17\src\org\lamw\lamw_hello_25_10_17\android-17
Panic: 
Panic: -check-env:
Panic:  [checkenv] Android SDK Tools Revision 25.2.5
Panic:  [checkenv] Installed at E:\lamw\android-sdk-windows
Panic: 
Panic: -setup:
Panic:      [echo] Project Name: lamw_hello_25_10_17
Panic:   [gettype] Project Type: Application
Panic: 
Panic: -pre-clean:
Panic: 
Panic: clean:
Panic:    [delete] Deleting directory E:\lamw\projects\tests\lamw_hello_25_10_17\bin
Panic:    [delete] Deleting directory E:\lamw\projects\tests\lamw_hello_25_10_17\gen
Panic: [getlibpath] Library dependencies:
Panic: [getlibpath] No Libraries
Panic:    [subant] No sub-builds to iterate on
Panic: 
Panic: -set-mode-check:
Panic: 
Panic: -set-debug-files:
Panic: 
Panic: -check-env:
Panic:  [checkenv] Android SDK Tools Revision 25.2.5
Panic:  [checkenv] Installed at E:\lamw\android-sdk-windows
Panic: 
Panic: -setup:
Panic:      [echo] Project Name: lamw_hello_25_10_17
Panic:   [gettype] Project Type: Application
Panic: 
Panic: -set-debug-mode:
Panic: 
Panic: -debug-obfuscation-check:
Panic: 
Panic: -pre-build:
Panic: 
Panic: -build-setup:
Panic: [getbuildtools] Using latest Build Tools: 26.0.1
Panic:      [echo] Resolving Build Target for lamw_hello_25_10_17...
Panic: [gettarget] Project Target:   Android 4.2.2
Panic: [gettarget] API level:        17
Panic:      [echo] ----------
Panic:      [echo] Creating output directories if needed...
Panic:     [mkdir] Created dir: E:\lamw\projects\tests\lamw_hello_25_10_17\bin
Panic:     [mkdir] Created dir: E:\lamw\projects\tests\lamw_hello_25_10_17\bin\res
Panic:     [mkdir] Created dir: E:\lamw\projects\tests\lamw_hello_25_10_17\bin\rsObj
Panic:     [mkdir] Created dir: E:\lamw\projects\tests\lamw_hello_25_10_17\bin\rsLibs
Panic:     [mkdir] Created dir: E:\lamw\projects\tests\lamw_hello_25_10_17\gen
Panic:     [mkdir] Created dir: E:\lamw\projects\tests\lamw_hello_25_10_17\bin\classes
Panic:     [mkdir] Created dir: E:\lamw\projects\tests\lamw_hello_25_10_17\bin\dexedLibs
Panic:      [echo] ----------
Panic:      [echo] Resolving Dependencies for lamw_hello_25_10_17...
Panic: [dependency] Ordered libraries:
Panic: [dependency] 
Panic: [dependency] ------------------
Panic:      [echo] ----------
Panic:      [echo] Building Libraries with 'debug'...
Panic:    [subant] No sub-builds to iterate on
Panic: 
Panic: -code-gen:
Panic: [mergemanifest] Merging AndroidManifest files into one.
Panic: [mergemanifest] Manifest merger disabled. Using project manifest only.
Panic:      [echo] Handling aidl files...
Panic:      [aidl] No AIDL files to compile.
Panic:      [echo] ----------
Panic:      [echo] Handling RenderScript files...
Panic:      [echo] ----------
Panic:      [echo] Handling Resources...
Panic:      [aapt] Generating resource IDs...
Panic:      [aapt] E:\lamw\projects\tests\lamw_hello_25_10_17\res\values-v21\styles.xml:11: error: Error: No resource found that matches the given name: attr 'android:colorAccent'.
Panic:      [aapt] 
Panic:      [aapt] E:\lamw\projects\tests\lamw_hello_25_10_17\res\values-v21\styles.xml:9: error: Error: No resource found that matches the given name: attr 'android:colorPrimary'.
Panic:      [aapt] 
Panic:      [aapt] E:\lamw\projects\tests\lamw_hello_25_10_17\res\values-v21\styles.xml:10: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'.
Panic:      [aapt] 
Panic: 
Panic: BUILD FAILED
Panic: E:\lamw\android-sdk-windows\tools\ant\build.xml:649: The following error occurred while executing this line:
Panic: E:\lamw\android-sdk-windows\tools\ant\build.xml:694: null returned: 1
Panic: 
Panic: Total time: 0 seconds
Panic: tool stopped with exit code 1. Use context menu to get more information.
Exception, Errors: 1
Fatal: [Exception] Failed: Cannot build APK!

When I comment in ..res\values-v21\styles.xml

    <style name="AppBaseTheme" parent="android:Theme.DeviceDefault">
        <!-- API 21 theme customizations can go here. -->
<!--
        <item name="android:colorPrimary">@color/primary</item>
        <item name="android:colorPrimaryDark">@color/primary_dark</item>
        <item name="android:colorAccent">@color/accent</item>
        <item name="android:textColorPrimary">@color/primary_text</item>
        <item name="android:textColorSecondary">@color/secondary_text</item>
        <item name="android:divider">@color/divider</item>
-->
    </style>

App build and install OK.
As I see in previous revisions ..res\values-v21\styles.xml nearly empty.

compile failure on Linux (can't find unit gl2surfaceview)

Attempt to build LAMW using FPCUpDeluxe on Linux. "Can't find unit gl2surfaceview used by Laz_And_Controls_Events"

Problem introduced in commit: a634d83

Error Log:
...
(1002) Target OS: Linux for x86-64
(3104) Compiling tfpandroidbridge_pack.pas
(3104) Compiling tcpsocketclient.pas
(3104) Compiling register_extras.pas
(3104) Compiling laz_and_controls_events.pas
/home/user/fpcupdeluxe/ccr/lamw/android_bridges/laz_and_controls_events.pas(164,33) Fatal: (10022) Can't find unit gl2surfaceview used by Laz_And_Controls_Events
Fatal: (1018) Compilation aborted

Error: /home/user/fpcupdeluxe/fpc/bin/x86_64-linux/ppcx64 returned an error exitcode
Error: (lazarus) Compile package tfpandroidbridge_pack 0.0: stopped with exit code 256
Error: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code 256"

fpcupdeluxe: ERROR: UniversalInstaller (ConfigModule: lamw): Failure trying to rebuild Lazarus.
Details: ERROR: Fpcupdeluxe fatal error !

Scrip fails and dont make ID nor FPC

I got this:
ln: failed to create symbolic link 'arm-linux-androideabi-as': File exists
ln: failed to create symbolic link 'arm-linux-androideabi-ld': File exists
ln: failed to create symbolic link 'arm-linux-as': File exists
ln: failed to create symbolic link 'arm-linux-ld': File exists
This script should not be run as root
MAKE THE WINDOWS win32 CROSSCOMPILER? yes

MAKE THE WINDOWS win64 CROSSCOMPILER?yes

MAKE THE ANDROID ARM CROSSCOMPILER?yes

MAKE THE ANDROID i386 CROSSCOMPILER?yes

BUILD LAZARUS?yes

/home/osboxes/bin/freepascal/fpc-setver-3.0.0.sh: line 29: /home/osboxes/bin/freepascal/fpc-bin/fpcmkcfg: No such file or directory

OK
fpc.fpg contains a valid gcc path
/usr/lib/gcc/x86_64-linux-gnu/5
make: *** No rule to make target 'distclean'. Stop.
make: *** No rule to make target 'clean'. Stop.
Processing makefile.fpc
Error: Unable to open file "makefile.fpc"
make: *** No rule to make target 'all'. Stop.
make: *** No rule to make target 'install'. Stop.
ls: cannot access '/home/osboxes/bin/freepascal/fpc_fixes_3_0/lib/fpc/3*': No such file or directory
basename: missing operand
Try 'basename --help' for more information.
unlink: cannot unlink '/home/osboxes/bin/freepascal/fpc-3.0.1': No such file or directory
cp: cannot stat '/home/osboxes/bin/freepascal/fpc_fixes_3_0/lib/fpc//ppc*': No such file or directory
/home/osboxes/bin/freepascal/fpc-setver-.sh: line 29: /home/osboxes/bin/freepascal/fpc-bin/fpcmkcfg: No such file or directory

OK
fpc.fpg contains a valid gcc path
/usr/lib/gcc/x86_64-linux-gnu/5
Processing makefile.fpc
Error: Unable to open file "makefile.fpc"
make: *** No rule to make target 'crossinstall'. Stop.
cp: cannot stat '/home/osboxes/bin/freepascal/fpc_fixes_3_0/lib/fpc//ppcross386': No such file or directory
Processing makefile.fpc
Error: Unable to open file "makefile.fpc"
make: *** No rule to make target 'crossinstall'. Stop.
cp: cannot stat '/home/osboxes/bin/freepascal/fpc_fixes_3_0/lib/fpc//ppcrossx86': No such file or directory
Processing makefile.fpc
Error: Unable to open file "makefile.fpc"
make: *** No rule to make target 'clean'. Stop.
make: *** No rule to make target 'crossinstall'. Stop.
cp: cannot stat '/home/osboxes/bin/freepascal/fpc_fixes_3_0/lib/fpc//ppcrossarm': No such file or directory
Processing makefile.fpc
Error: Unable to open file "makefile.fpc"
make: *** No rule to make target 'clean'. Stop.
make: *** No rule to make target 'crossinstall'. Stop.
cp: cannot stat '/home/osboxes/bin/freepascal/fpc_fixes_3_0/lib/fpc//ppcross386': No such file or directory
cp: cannot stat '/home/osboxes/bin/freepascal/fpc_fixes_3_0/lib/fpc//ppcross386': No such file or directory
make: *** No rule to make target 'clean'. Stop.
make: *** No rule to make target 'all'. Stop.
strip: 'lazarus': No such file
strip: 'lazbuild': No such file
strip: 'startlazarus': No such file
--2017-10-27 13:00:13-- https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz

Sdk is installed, but no lazarus IDE nor fpc...
where is the problem?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.