Recent

Author Topic: Tutorial - Android & Lazarus for novices like me  (Read 72416 times)

magleft

  • Full Member
  • ***
  • Posts: 107
Re: Tutorial - Android & Lazarus for novices like me
« Reply #30 on: June 27, 2015, 09:26:08 pm »
@rx3
Thanks for your answer. I will try.
Best Regards
windows 10 64

ryan103

  • Newbie
  • Posts: 1
Re: Tutorial - Android & Lazarus for novices like me
« Reply #31 on: August 28, 2016, 05:53:19 pm »
I am not a newbie to Delphi or Lazarus but a newbie to Android programming. I guess I have been to used to a 'set and forget about it' type of compiler. In any event, I followed these instructions above explicitly, checked my paths and etc.

I get the following errors;

C:\Android\laz4android\fpc\2.7.1\bin\i386-win32\arm-linux-androideabi-ld.bfd.exe: cannot find crtbegin_so.o
C:\Android\laz4android\fpc\2.7.1\bin\i386-win32\arm-linux-androideabi-ld.bfd.exe: cannot find -ljnigraphics
C:\Android\laz4android\fpc\2.7.1\bin\i386-win32\arm-linux-androideabi-ld.bfd.exe: cannot find -llog
C:\Android\laz4android\fpc\2.7.1\bin\i386-win32\arm-linux-androideabi-ld.bfd.exe: cannot find -lc
C:\Android\laz4android\fpc\2.7.1\bin\i386-win32\arm-linux-androideabi-ld.bfd.exe: cannot find -lc

What in the world are these files that the linker cannot find? Look more like command line arguments, but...

Also, I did not see an option under linking that would allow the strip symbols, (-Xs). Could that be my problem?

Thanks for any help or pointers!

John

I had similar error when compile in lazarus.  My laztoapk is 0.9.0.35.

D:\laztoapk\downloads\laz4android\fpc\3.0.0\bin\i386-win32\arm-linux-androideabi-ld.bfd.exe: cannot find crtbegin_so.o

after reading http://wiki.freepascal.org/Android_tutorial#Compile_the_demo_.22androidlcl.22   

I notice the library path in default value of "project option/compilation option/path / library " is not correct, where it is
D:\android-ndk-r10e\platforms\android-8\arch-arm\usr\lib\;D:\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.9\

they are not my actual path,  Missing the "prefix" path  -   "D:\laztoapk\downloads"  for my environment.

Corrected them as shown below, and recompilation succeed!


D:\laztoapk\downloads\android-ndk-r10e\platforms\android-8\arch-arm\usr\lib\;D:\laztoapk\downloads\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.9\

Hope this help the author if this is a bug.

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 255
    • Fresh sound.
Re: Tutorial - Android & Lazarus for novices like me
« Reply #32 on: August 28, 2016, 07:01:32 pm »
Thank you for this problem report. I will have a look into this.
Linux Mint 20.3, Lazarus 2.3, Windows 10, Delphi 10.3 Rio, Delphi 11.1 Alexandria

axel234

  • New Member
  • *
  • Posts: 10
Re: Tutorial - Android & Lazarus for novices like me
« Reply #33 on: February 12, 2017, 09:54:56 pm »
Hi Guys!

I'm trying to install Laz4Android step by step using the instructions from this post, but I get an error while trying to compile the demo project (screenshot attached). Could you please help me?

I was trying to find the answer in the internet, but no luck.
Regards.


axel234

  • New Member
  • *
  • Posts: 10
Re: Tutorial - Android & Lazarus for novices like me
« Reply #35 on: February 13, 2017, 02:11:53 pm »
Yeah man! It's working! Thank you.

axel234

  • New Member
  • *
  • Posts: 10
Re: Tutorial - Android & Lazarus for novices like me
« Reply #36 on: February 25, 2017, 11:38:10 pm »
Hi. All the components marked as Laz_And_Controls, such as JButton work well. I can add them to the form and run the app.
All the components not marked as Laz_And_Controls such as jRatingBar or jSpinner are not installed, so I tried to install all the components from the laz4android\components\lazandroidmodulewizard-master. The installation went ok, lazarus is rebuilt, but did not start after rebuild. When I start it manually I get the error that there is no sqlite.dll and it won't start. I tried to install the Sqlite from here: https://www.tutorialspoint.com/sqlite/sqlite_installation.htm, but no luck. There is sqlite.dll still missing.
I'm using the W10 64bit. What went wrong?

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: Tutorial - Android & Lazarus for novices like me
« Reply #37 on: February 26, 2017, 05:38:01 am »

Hi, axel234

Are You mixing "Custom Drawn" framework with LAMW framework?
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

axel234

  • New Member
  • *
  • Posts: 10
Re: Tutorial - Android & Lazarus for novices like me
« Reply #38 on: February 26, 2017, 01:57:54 pm »
Hi!

What do you mean by saying "mixing"?
Custom Drawn package is on my INSTALLED packages list. Shall I uninstall it?


This is the error message I get while trying to build the project which I added a jRatingBar in (it's the only component on the form).

Code: Diff  [Select][+][-]
  1. [code=xml](1008) 608 lines compiled, 0.7 sec
  2. (1022) 5 hint(s) issued
  3. Buildfile: C:\Android\Projekty\LamwGUIProject6\build.xml
  4.      [copy] Copying 4 files to C:\Android\Projekty\LamwGUIProject6\src\org\lamw\lamwguiproject6\android-14
  5.  
  6. -check-env:
  7.  [checkenv] Android SDK Tools Revision 24.4.1
  8.  [checkenv] Installed at C:\Android\android-sdk
  9.  
  10. -setup:
  11.      [echo] Project Name: LamwGUIProject6
  12.   [gettype] Project Type: Application
  13.  
  14. -pre-clean:
  15.  
  16. clean:
  17.    [delete] Deleting directory C:\Android\Projekty\LamwGUIProject6\bin
  18.    [delete] Deleting directory C:\Android\Projekty\LamwGUIProject6\gen
  19. [getlibpath] Library dependencies:
  20. [getlibpath] No Libraries
  21.    [subant] No sub-builds to iterate on
  22.  
  23. -set-mode-check:
  24.  
  25. -set-debug-files:
  26.  
  27. -check-env:
  28.  [checkenv] Android SDK Tools Revision 24.4.1
  29.  [checkenv] Installed at C:\Android\android-sdk
  30.  
  31. -setup:
  32.      [echo] Project Name: LamwGUIProject6
  33.   [gettype] Project Type: Application
  34.  
  35. -set-debug-mode:
  36.  
  37. -debug-obfuscation-check:
  38.  
  39. -pre-build:
  40.  
  41. -build-setup:
  42. [getbuildtools] Using latest Build Tools: 19.1.0
  43.      [echo] Resolving Build Target for LamwGUIProject6...
  44. [gettarget] Project Target:   Android 4.0
  45. [gettarget] API level:        14
  46.      [echo] ----------
  47.      [echo] Creating output directories if needed...
  48.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject6\bin
  49.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject6\bin\res
  50.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject6\bin\rsObj
  51.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject6\bin\rsLibs
  52.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject6\gen
  53.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject6\bin\classes
  54.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject6\bin\dexedLibs
  55.      [echo] ----------
  56.      [echo] Resolving Dependencies for LamwGUIProject6...
  57. [dependency] Ordered libraries:
  58. [dependency]
  59. [dependency] ------------------
  60. [dependency] API<=15: Adding annotations.jar to the classpath.
  61.      [echo] ----------
  62.      [echo] Building Libraries with 'debug'...
  63.    [subant] No sub-builds to iterate on
  64.  
  65. -code-gen:
  66. [mergemanifest] Merging AndroidManifest files into one.
  67. [mergemanifest] Manifest merger disabled. Using project manifest only.
  68.      [echo] Handling aidl files...
  69.      [aidl] No AIDL files to compile.
  70.      [echo] ----------
  71.      [echo] Handling RenderScript files...
  72.      [echo] ----------
  73.      [echo] Handling Resources...
  74.      [aapt] Generating resource IDs...
  75.      [echo] ----------
  76.      [echo] Handling BuildConfig class...
  77. [buildconfig] Generating BuildConfig class.
  78.  
  79. -pre-compile:
  80.  
  81. -compile:
  82.     [javac] Compiling 6 source files to C:\Android\Projekty\LamwGUIProject6\bin\classes
  83.     [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
  84.     [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
  85.     [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
  86.     [javac] C:\Android\Projekty\LamwGUIProject6\src\org\lamw\lamwguiproject6\android-14\jRatingBar.java:177: error: cannot find symbol
  87.     [javac]                 ((RelativeLayout.LayoutParams)lparams).removeRule(lparamsAnchorRule[i]);
  88.     [javac]                                                       ^
  89.     [javac]   symbol:   method removeRule(int)
  90.     [javac]   location: class LayoutParams
  91.     [javac] C:\Android\Projekty\LamwGUIProject6\src\org\lamw\lamwguiproject6\android-14\jRatingBar.java:181: error: cannot find symbol
  92.     [javac]                 ((RelativeLayout.LayoutParams)lparams).removeRule(lparamsParentRule[j]);
  93.     [javac]                                                       ^
  94.     [javac]   symbol:   method removeRule(int)
  95.     [javac]   location: class LayoutParams
  96.     [javac] 2 errors
  97.     [javac] 3 warnings
  98.  
  99. BUILD FAILED
  100. C:\Android\android-sdk\tools\ant\build.xml:716: The following error occurred while executing this line:
  101. C:\Android\android-sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
  102.  
  103. Total time: 2 seconds
  104. Exception, Errors: 1
  105. Fatal: [Exception] Failed: Cannot build APK!
  106.  
« Last Edit: February 26, 2017, 02:00:29 pm by axel234 »

Thaddy

  • Hero Member
  • *****
  • Posts: 14159
  • Probably until I exterminate Putin.
Re: Tutorial - Android & Lazarus for novices like me
« Reply #39 on: February 26, 2017, 02:19:19 pm »
I think it is that you do not understand that there are multiple ways to program for Android.
1. using OwnerDrawn and JNI techniques
2. Using LAMW, using Android native widgets.
3. Just using JVM for Android. (which is what I do)
4. ..... I lost the plot by now...

Although technically it is possible to mix them, you should not do that without sufficient knowledge. (Creating libraries, link in and compile the whole shebang)
That's not your fault. The wiki entries regarding Android are a huge mess and even for me completely incomprehensible.
The wiki needs to be cleaned up.

LAWM is the most mature. It also means you can not expect every available control to work either way.

Look at it this way:
Delphi has VCL and FireStarter (or something - don't react plz  O:-) ): you can not mix them easily
FPC has Ownerdrawn, QT, GTK, WIN ...etc. You can not mix them. You will have to make a choice about your available widget set. Always.
« Last Edit: February 26, 2017, 02:26:53 pm by Thaddy »
Specialize a type, not a var.

axel234

  • New Member
  • *
  • Posts: 10
Re: Tutorial - Android & Lazarus for novices like me
« Reply #40 on: February 26, 2017, 02:31:27 pm »
You are totally true. I'm the newbie in Laz4Android.

The only thing I'd like to know is: what shall I do to make any components from Android Bridge tab, that are not marked as Laz_And_Controls work in the application. I mean, to build the app with no errors. Is it possible to do it?

Thaddy

  • Hero Member
  • *****
  • Posts: 14159
  • Probably until I exterminate Putin.
Re: Tutorial - Android & Lazarus for novices like me
« Reply #41 on: February 26, 2017, 02:35:53 pm »
I have experience with all the top three options I gave you, but I will leave that to @jmpessoa

If you are inexperienced, LAMW is the best option. By far.  If you are really experienced you can use all of them.
Specialize a type, not a var.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: Tutorial - Android & Lazarus for novices like me
« Reply #42 on: February 26, 2017, 04:47:45 pm »


Quote
error: cannot find symbol
((RelativeLayout.LayoutParams)lparams).removeRule(lparamsAnchorRule).....

Please, for now, try change "minSdk" to 17  in "AndroidManifest.xml" file.

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

axel234

  • New Member
  • *
  • Posts: 10
Re: Tutorial - Android & Lazarus for novices like me
« Reply #43 on: February 26, 2017, 06:04:11 pm »
Sorry, it didn't help :(


Code: Diff  [Select][+][-]
  1. (1008) 577 lines compiled, 0.7 sec
  2. (1022) 5 hint(s) issued
  3. Buildfile: C:\Android\Projekty\LamwGUIProject1\build.xml
  4.      [copy] Copying 4 files to C:\Android\Projekty\LamwGUIProject1\src\org\lamw\lamwguiproject1\android-14
  5.  
  6. -check-env:
  7.  [checkenv] Android SDK Tools Revision 24.4.1
  8.  [checkenv] Installed at C:\Android\android-sdk
  9.  
  10. -setup:
  11.      [echo] Project Name: LamwGUIProject1
  12.   [gettype] Project Type: Application
  13.  
  14. -pre-clean:
  15.  
  16. clean:
  17.    [delete] Deleting directory C:\Android\Projekty\LamwGUIProject1\bin
  18.    [delete] Deleting directory C:\Android\Projekty\LamwGUIProject1\gen
  19. [getlibpath] Library dependencies:
  20. [getlibpath] No Libraries
  21.    [subant] No sub-builds to iterate on
  22.  
  23. -set-mode-check:
  24.  
  25. -set-debug-files:
  26.  
  27. -check-env:
  28.  [checkenv] Android SDK Tools Revision 24.4.1
  29.  [checkenv] Installed at C:\Android\android-sdk
  30.  
  31. -setup:
  32.      [echo] Project Name: LamwGUIProject1
  33.   [gettype] Project Type: Application
  34.  
  35. -set-debug-mode:
  36.  
  37. -debug-obfuscation-check:
  38.  
  39. -pre-build:
  40.  
  41. -build-setup:
  42. [getbuildtools] Using latest Build Tools: 19.1.0
  43.      [echo] Resolving Build Target for LamwGUIProject1...
  44. [gettarget] Project Target:   Android 4.0
  45. [gettarget] API level:        14
  46. [gettarget] WARNING: Attribute minSdkVersion in AndroidManifest.xml (17) is higher than the project target API level (14)
  47.      [echo] ----------
  48.      [echo] Creating output directories if needed...
  49.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject1\bin
  50.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject1\bin\res
  51.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject1\bin\rsObj
  52.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject1\bin\rsLibs
  53.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject1\gen
  54.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject1\bin\classes
  55.     [mkdir] Created dir: C:\Android\Projekty\LamwGUIProject1\bin\dexedLibs
  56.      [echo] ----------
  57.      [echo] Resolving Dependencies for LamwGUIProject1...
  58. [dependency] Ordered libraries:
  59. [dependency]
  60. [dependency] ------------------
  61. [dependency] API<=15: Adding annotations.jar to the classpath.
  62.      [echo] ----------
  63.      [echo] Building Libraries with 'debug'...
  64.    [subant] No sub-builds to iterate on
  65.  
  66. -code-gen:
  67. [mergemanifest] Merging AndroidManifest files into one.
  68. [mergemanifest] Manifest merger disabled. Using project manifest only.
  69.      [echo] Handling aidl files...
  70.      [aidl] No AIDL files to compile.
  71.      [echo] ----------
  72.      [echo] Handling RenderScript files...
  73.      [echo] ----------
  74.      [echo] Handling Resources...
  75.      [aapt] Generating resource IDs...
  76.      [echo] ----------
  77.      [echo] Handling BuildConfig class...
  78. [buildconfig] Generating BuildConfig class.
  79.  
  80. -pre-compile:
  81.  
  82. -compile:
  83.     [javac] Compiling 6 source files to C:\Android\Projekty\LamwGUIProject1\bin\classes
  84.     [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
  85.     [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
  86.     [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
  87.     [javac] C:\Android\Projekty\LamwGUIProject1\src\org\lamw\lamwguiproject1\android-14\jRatingBar.java:177: error: cannot find symbol
  88.     [javac]                 ((RelativeLayout.LayoutParams)lparams).removeRule(lparamsAnchorRule[i]);
  89.     [javac]                                                       ^
  90.     [javac]   symbol:   method removeRule(int)
  91.     [javac]   location: class LayoutParams
  92.     [javac] C:\Android\Projekty\LamwGUIProject1\src\org\lamw\lamwguiproject1\android-14\jRatingBar.java:181: error: cannot find symbol
  93.     [javac]                 ((RelativeLayout.LayoutParams)lparams).removeRule(lparamsParentRule[j]);
  94.     [javac]                                                       ^
  95.     [javac]   symbol:   method removeRule(int)
  96.     [javac]   location: class LayoutParams
  97.     [javac] 2 errors
  98.     [javac] 3 warnings
  99.  
  100. BUILD FAILED
  101. C:\Android\android-sdk\tools\ant\build.xml:716: The following error occurred while executing this line:
  102. C:\Android\android-sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
  103.  
  104. Total time: 2 seconds
  105. Exception, Errors: 1
  106. Fatal: [Exception] Failed: Cannot build APK!

jmpessoa

  • Hero Member
  • *****
  • Posts: 2296
Re: Tutorial - Android & Lazarus for novices like me
« Reply #44 on: February 26, 2017, 07:24:20 pm »
Quote
gettarget] WARNING: Attribute minSdkVersion in AndroidManifest.xml (17) is higher than the project target API level (14)

if minSDK = 17 then
 change target API = 17   in "AndroidManifest.xml"   [or >]

go to "build.xml"  and fix the new target api


Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018