Lazarus

Programming => Operating Systems => Android => Topic started by: kitsaros on October 21, 2013, 10:02:40 pm

Title: Tutorial - Android & Lazarus for novices like me
Post by: kitsaros on October 21, 2013, 10:02:40 pm
I have made a quick tutorial on how to create android apps with Lazarus.
In this tutorial i am using JDK 1.6u45 + SDK 22.2.1 + ndk-r9 + Laz4Android1.1-41139-FPC2.7.1

1)Create on C:\ a folder called "Android"

2)Install JDK 1.6u45 (i have installed jdk-6u45-windows-x64.exe)
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR
It will be installed in to C:\Program Files\Java\.

3) Installing SDK ...
Go to http://developer.android.com/sdk/index.html
DOWNLOAD FOR OTHER PLATFORMS > SDK Tools Only
installer_r22.2.1-windows.exe (Recommended)
Install sdk (installer_r22.2.1-windows) into C:\Android\android-sdk
Copy at "C:\Android\android-sdk\tools" the file "apkbuilder.bat" (can be found here
https://github.com/ACSOP/android_sdk/raw/master/apkbuilder/etc/apkbuilder.bat )

Now update the SDK [WIN START > SDK Manager ]
add android 4.0 (API 14)
add android 2.2 (API 8]
Install packages.

4) Installing NDK ...
http://developer.android.com/tools/sdk/ndk/index.html
Download only the file android-ndk-r9-windows-x86.zip
Unzip android-ndk-r9-windows-x86.zip into C:\Android\android-ndk-r9

5) Installing Laz4Android1.1-41139-FPC2.7.1.7z ...
Download it from https://skydrive.live.com/?cid=89ae6b50650182c6&id=89AE6B50650182C6!149
Unzip Laz4Android1.1-41139-FPC2.7.1.7z into C:\Android\laz4android
Copy
C:\Android\android-ndk-r9\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-*.exe
to
C:\Android\laz4android\fpc\2.7.1\bin\i386-win32\*

Edit the file C:\Android\laz4android\build.bat like this :
SET FPC_BIN_PATH=C:\Android\laz4android
Run build.bat (doubleclick) ->  It will compile & bulid lazarus.

6) Rebuilding Laz4Android IDE ...
Run C:\Android\laz4android\lazarus.exe
Select "Start IDE"
select "Package" "Install/Uninstall Packages"
select customdrawn 0.0 > install selection and hit save and rebuild IDE , continue

7) Compiling the demo "androidlcl"
Copy C:\Android\laz4android\examples\androidlcl at D:\Projects\android\androidlcl
Run "C:\Android\laz4android\lazarus.exe"
File > open "D:\Projects\android\androidlcl\androidlcltest.lpr"
Project > project options

Compiler options >  select "Release TAndroid"

Paths > 

Libraries -Ll :
C:\Android\android-ndk-r9\platforms\android-8\arch-arm\usr\lib;C:\Android\android-ndk-r9\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.6

Target file name :
android\libs\armeabi\liblclapp.so

Code generation
  Target OS -T android
  Target CPU -P arm
  Target processor default

Linking :
  Enable strip symbols (-Xs)

Other : -dANDROID -Xd -CpARMV6 -FLlibdl.so

Ide macro values :
macro name : LCLWidgetType
macro value : customdrawn

Now
Run > Compile this will generate this library :
D:\Projects\android\androidlcl\android\libs\armeabi\liblclapp.so [5.073 kb]

8] Deployment ...
a) Edit with a text editor
D:\Projects\android\androidlcl\android\generate_debug_key.bat
Modify the first 6 lines like this :
Code: [Select]
REM Adjust these paths to yours
SET PATH=C:\Android\android-sdk\tools;C:\Android\android-sdk\build-tools\17.0.0;C:\Android\android-sdk\platform-tools\;C:\Progra~1\Java\jdk1.6.0_45\bin
SET APP_NAME=lcltest
SET ANDROID_HOME=C:\Android\android-sdk
SET APK_SDK_PLATFORM=C:\Android\android-sdk\platforms\android-8
SET APK_PROJECT_PATH=D:\Projects\android\androidlcl\android
Run "generate_debug_key.bat"
Use as password : "senhas"
This will produce the file :
D:\Projects\android\androidlcl\android\bin\LCLDebugKey.keystore

b) Edit with a text editor
D:\Projects\android\androidlcl\android\build_debug_apk.bat
Modify the first 6 lines like this :
Code: [Select]
REM Adjust these paths to yours
SET PATH=C:\Android\android-sdk\tools;C:\Android\android-sdk\build-tools\17.0.0;C:\Android\android-sdk\platform-tools\;C:\Progra~1\Java\jdk1.6.0_45\bin
SET APP_NAME=lcltest
SET ANDROID_HOME=C:\Android\android-sdk
SET APK_SDK_PLATFORM=C:\Android\android-sdk\platforms\android-8
SET APK_PROJECT_PATH=D:\Projects\android\androidlcl\android
run "build_debug_apk.bat" answer at the questions and give the password "senhas" when asked
This will generate
D:\Projects\android\androidlcl\android\bin\lcltest.apk [1.549 kb]

c) Create an Android Virtual Device
START >  AVD Manager
New > AVD name > give a name
Device 5.1 WVGA
Target Android 4 API 14
Hit OK
Once created select the virtual device and hit "start" > "Launch" wait a couple of minutes.
 

d) Edit with a text editor
D:\Projects\android\androidlcl\android\adb_install.bat
Modify  like this : 
Code: [Select]
REM Adjust these paths to yours
SET PATH=C:\Android\android-sdk\tools;C:\Android\android-sdk\build-tools\17.0.0;C:\Android\android-sdk\platform-tools\;C:\Progra~1\Java\jdk1.6.0_45\bin

adb uninstall com.pascal.lcltest
adb install bin\lcltest.apk

pause
Run "adb_install.bat" . This will install the "LCL Test" into your Virtual device

e) Debugging
Edit with a text editor the file 
D:\Projects\android\androidlcl\android\adb_install.bat
like this :
Code: [Select]
REM Adjust these paths to yours
SET PATH=C:\Android\android-sdk\tools;C:\Android\android-sdk\build-tools\17.0.0;C:\Android\android-sdk\platform-tools\;C:\Progra~1\Java\jdk1.6.0_45\bin

adb logcat > std.txt

pause
By running this you will get a debug file here :
D:\Projects\android\androidlcl\android\std.txt

Enjoy !
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: jwdietrich on October 21, 2013, 10:27:31 pm
Thank you! Would you mind to write a tutorial like this in the Lazarus wiki (http://wiki.lazarus.freepascal.org/)?
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: Daren453 on November 04, 2013, 01:55:48 am
I have tried three other installation tutorials and this one was the first that worked for me. Thanks!
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: sys on November 26, 2013, 07:24:49 pm
Followed steps (updated paths, build-tools\19.0.0 and ..android-ndk-r9b..)

No problems, but running "lcl test" crashes (Unfortuntely, LCL Test has stopped)

E/AndroidRuntime(  631): FATAL EXCEPTION: main
E/AndroidRuntime(  631): java.lang.UnsatisfiedLinkError: LCLOnCreate

Did something wrong?
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: kitsaros on December 03, 2013, 06:00:15 pm
@sys pay attention at the 8] step. check the paths !
@all : i do not have the time to post it to the wiki but i wish someone does this work. I do not request anything in exchange i just wanted to help.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: johnjces on February 21, 2014, 04:10:13 am
I am not new to Delphi or Lazarus, but can anyone advise if these instructions work for the SourceForge project laz2android at

http://sourceforge.net/projects/laz4android/ and...

has anyone had any luck with laztoapk, also located on SourceForge at

http://sourceforge.net/projects/laztoapk/

I have Googled and searched and have just now come across this setup tutorial and I have been beating my head against a rock for days trying to get things to work. Plus, there is no forum or wiki on the above SourceForge sites.

One last question, in my attempts to compile up an Android app, such as the lcl android example, I have had better luck with 'Quick Compile'. Compile, Build etc always error. So, if las4android gets setup correctly, what build/compile option is used?

Thanks.

John
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: johnjces on February 21, 2014, 07:00:45 am
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
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: DelphiFreak on February 21, 2014, 07:09:54 am
Hi,

I am the author of the tutorial and the developer of laztoapk and truetom is the author of laz4android.

As the name of my setup says, it's "alpha" and "experimental".
To setup the whole toolchain is very tricky and depends on so many tools&frameworks. (jdk,sdk,ndk,lazarus,fpc,customdrawn components).

I am working hard on a new version of the tutorial and a new setup, but my sparetime is very limited.

The version 41139 from May 2013 is here and creates working apps.
http://sdrv.ms/12cHbIZ (http://sdrv.ms/12cHbIZ)

The version 43585 from http://sourceforge.net/projects/laz4android/  (http://sourceforge.net/projects/laz4android/) does also create executables, but they crash as soon as you click onto the app.

Me and truetom have no idea why. I have filled a bug in the fpc bugtracker about the problem.

So I have to go back to laz4android 41139 at the moment, release a new setup and update the tutorial.
I am not sure if this is all possibile this weekend. Please be patient.


Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: DelphiFreak on February 21, 2014, 11:08:29 pm
Ok, new setup and new tutorial is now available here http://sourceforge.net/projects/laztoapk/files/?source=navbar (http://sourceforge.net/projects/laztoapk/files/?source=navbar)

Have fun.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: johnjces on February 22, 2014, 03:03:26 am
@ DelphiFreak. Thanks so much! I do realize all is Alpha at best and thank-you so much for your help, making this stuff available on Sourceforge as well. I will check it out and please know your work and time is appreciated.

John
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: johnjces on February 22, 2014, 05:36:29 pm
Good day!

Since I really would like to help with this project, I thought I'd give my results on the latest laz4android and laztoapk. I am not certain exactly where to report joy and no-joy, so if there is a better place, please let me know.

I have a Lenovo T61 laptop with a Core 2 Duo, 4 gb of ram and 32 bit Windows 7 Ultimate. I followed the instructions to the letter and this time I even downloaded the exact JDK mentioned near the top of the tutorial from Oracle. I had to create an account to get an archived JDK.

I created an Android directory off of my root, C:\android and made certain that all files and all directories had full permissions and and everything had read/write permissions to ensure no issues with UAC, etc. Installed everything into this directory and followed the guide, double checking my work/entries.

Following the tutorial I created the empty project1 directory as directed in laztoapk and did the build and install project, and was pleased that a lazarus project was created in this directory. Continuing and after creating the key and entering the password, everything worked to that point and I was reminded to enter the password in subsequent screens as it tries to build an APK.

Moving on and entering the password, entering other stuff, i.e., name, city and etc., it came time to enter the password again or hit enter to use the same password. Beyond this point it errors every time not being able to find project1-realigned.apk. I do get a zero byte project1-unsigned.apk. It simply cannot find files.

I moved things around to my C:\users\john directory thinking I had some permissions issues. I will explore this a bit further.

In trying to laz4android again, I get the get the exact same errors when trying to compile the project1 example or the lcl example as posted above. It cannot find files that appear to be command line arguments.

@Delphifreak, what OS are you using in which things work? Anyway, just a report hoping it is helpful to you.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: DelphiFreak on February 22, 2014, 06:26:41 pm
Hello  johnjces,

thank you for your feedback. I use Windows XP SP3.

Go to the folder project1\android

You will find the batch file "build_debug_apk.bat".
Open it with a text editor and add the word "pause" at the end. Save the batch file and run it.
Then provide me please the screen output. I will try to help you.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: johnjces on February 23, 2014, 05:14:17 am
Thanks DelphiFreak!

I have uninstalled everything and reinstalled everything, (getting good at it), and now was able to create a good apk! Not certain what my issue is/was. But now I am having difficulty with my Android emulator. It starts and just keeps 'twinkling' ANDROID and it never starts as it did before.

So, I need to reinstall the AVD and see what happens. I'll report later. But I wish I knew what my problem was and how doing another install solved it.

john
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: johnjces on February 23, 2014, 05:36:33 pm
Got all things working and I am impressed.  ::)

I still cannot compile the LCL example under the laz4android\examples directory, however.  %)

Now to learn nuances of Android programming and see if Lazarus and FPC is viable.

Obviously, Lazarus cannot create an Android project and a new project needs to be hand written or started with laztoapk. Is this correct?

Thanks!
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: Mazarus on February 23, 2014, 09:17:34 pm
Hello, I'm new here. :)

Thanks to DelphiFreak, I was able to create an apk. The new tutorial and laztoapk helped so much!

Here are some things I discovered and I will remember for using laztoapk:

1. To install or uninstall an apk, the AVD device has to run.
2. I had the same problem like johnjces. For no obvious reason, my created AVD device freezed while starting.  It showed this "Android" starting sequence forever. I had to delete it and created a new device.
3. When I type in my password for creating the Android key, there is no visual hint that I'm typing, but the program is receiving the input. I don't need to type in any real personal information when the program asks for name, etc. ENTER is enough. After asking this personal information, I have to type in any letter (but not "n") and ENTER to continue.

I have a general Android question:
Where do I see the limitations of programming for Android? For example: I made a TCDButton green in Lazarus. It still was gray in the AVD device. TTimer works. Canvas.Pixels doesn't. TButton does. So I would really like to know what Components/Properties are supported by Android.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: Chronos on March 02, 2014, 08:17:11 pm
Created wiki page: http://wiki.freepascal.org/Android_tutorial
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: Sibylla on April 06, 2014, 09:04:35 pm
Hi,
I encounter a problem with the Android installation at: http://wiki.freepascal.org/Android_tutorial
All steps are ok until Deployment and the C:\Android\Projects\androidlcl\android\build_debug_apk.bat file. I modify the build_debug_apk.bat with the following paths:

REM Adjust these paths to yours
SET PATH=C:\android\android-sdk\tools;C:\android\android-sdk\build-tools\19.0.3;C:\android\android-sdk\platform-tools\;C:\Program Files (x86)\Java\jdk1.6.0_45\bin
SET APP_NAME=lcltest
SET ANDROID_HOME=C:\android\android-sdk
SET APK_SDK_PLATFORM=C:\android\android-sdk\platforms\android-8
SET APK_PROJECT_PATH=C:\android\projects\androidlcl\android

But when I execute the build_debug_apk.bat file, I get a lcltest-unsigned.apk file with 0 octet length.
The resulting file is the follwing:

symbol  : class ViewGroup
location: class com.pascal.lcltest.LCLActivity.LCL_ListViewAdapter
    @Override public View getView(int position, View convertView, ViewGroup pare
nt)
                                                                  ^
src\com\pascal\lcltest\LCLActivity.java:760: cannot find symbol
symbol  : class View
location: class com.pascal.lcltest.LCLActivity.LCL_ListViewAdapter
    @Override public View getView(int position, View convertView, ViewGroup pare
nt)
                     ^
[loading java\lang\Override.class(java\lang:Override.class)]
[loading java\lang\annotation\Annotation.class(java\lang\annotation:Annotation.c
lass)]
[loading java\lang\SuppressWarnings.class(java\lang:SuppressWarnings.class)]
[loading java\lang\annotation\Target.class(java\lang\annotation:Target.class)]
[loading java\lang\annotation\ElementType.class(java\lang\annotation:ElementType
.class)]
[loading java\lang\annotation\Retention.class(java\lang\annotation:Retention.cla
ss)]
[loading java\lang\annotation\RetentionPolicy.class(java\lang\annotation:Retenti
onPolicy.class)]
[checking com.pascal.lcltest.LCLActivity]
src\com\pascal\lcltest\LCLActivity.java:38: cannot find symbol
symbol  : class View
location: class com.pascal.lcltest.LCLActivity.LCLInputConnection
      _lclView = (View) targetView;
                  ^
[loading java\lang\Integer.class(java\lang:Integer.class)]
[loading java\lang\Number.class(java\lang:Number.class)]
src\com\pascal\lcltest\LCLActivity.java:55: cannot find symbol
symbol  : variable Log
location: class com.pascal.lcltest.LCLActivity.LCLInputConnection
      Log.v("lclproject", "LCLInputConnection.commitText =" + text + " newCursor
Position=" + Integer.toString(newCursorPosition));
      ^
src\com\pascal\lcltest\LCLActivity.java:52: method does not override or implemen
t a method from a supertype
    @Override public boolean commitText(CharSequence text, int newCursorPosition
)
    ^
src\com\pascal\lcltest\LCLActivity.java:69: cannot find symbol
symbol  : variable Log
location: class com.pascal.lcltest.LCLActivity.LCLInputConnection
      Log.v("lclproject", "LCLInputConnection.deleteSurroundingText left=" + Int
eger.toString(leftLength) + " right=" + Integer.toString(rightLength));
      ^
src\com\pascal\lcltest\LCLActivity.java:75: cannot find symbol
symbol  : variable KeyEvent
location: class com.pascal.lcltest.LCLActivity.LCLInputConnection
        eventResult = LCLOnKey(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL, null,
 (char) 0);
                               ^
src\com\pascal\lcltest\LCLActivity.java:75: cannot find symbol
symbol  : variable KeyEvent
location: class com.pascal.lcltest.LCLActivity.LCLInputConnection
        eventResult = LCLOnKey(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL, null,
 (char) 0);
                                                     ^
src\com\pascal\lcltest\LCLActivity.java:77: cannot find symbol
symbol  : variable KeyEvent
location: class com.pascal.lcltest.LCLActivity.LCLInputConnection
        eventResult = LCLOnKey(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL, null, (
char) 0);
                               ^
src\com\pascal\lcltest\LCLActivity.java:77: cannot find symbol
symbol  : variable KeyEvent
location: class com.pascal.lcltest.LCLActivity.LCLInputConnection
        eventResult = LCLOnKey(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL, null, (
char) 0);
                                                   ^
src\com\pascal\lcltest\LCLActivity.java:91: cannot find symbol
symbol  : variable super
location: class com.pascal.lcltest.LCLActivity.LCLInputConnection
      return super.deleteSurroundingText(leftLength, rightLength);
             ^
src\com\pascal\lcltest\LCLActivity.java:67: method does not override or implemen
t a method from a supertype
    @Override public boolean deleteSurroundingText(int leftLength, int rightLeng
th)
    ^
src\com\pascal\lcltest\LCLActivity.java:106: cannot find symbol
symbol  : method setWillNotDraw(boolean)
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      setWillNotDraw(false);
      ^
src\com\pascal\lcltest\LCLActivity.java:108: cannot find symbol
symbol  : method setWillNotCacheDrawing(boolean)
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      setWillNotCacheDrawing(true);
      ^
src\com\pascal\lcltest\LCLActivity.java:110: cannot find symbol
symbol  : method requestFocus()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      requestFocus();
      ^
src\com\pascal\lcltest\LCLActivity.java:111: cannot find symbol
symbol  : method setFocusableInTouchMode(boolean)
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      setFocusableInTouchMode(true);
      ^
src\com\pascal\lcltest\LCLActivity.java:117: cannot find symbol
symbol  : method getWidth()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      int lWidth = getWidth();
                   ^
src\com\pascal\lcltest\LCLActivity.java:118: cannot find symbol
symbol  : method getHeight()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      int lHeight = getHeight();
                    ^
src\com\pascal\lcltest\LCLActivity.java:136: package Bitmap does not exist
        canvasbitmap = Bitmap.createBitmap(lWidth, lHeight, Bitmap.Config.ARGB_8
888);
                                                                  ^
src\com\pascal\lcltest\LCLActivity.java:136: cannot find symbol
symbol  : variable Bitmap
location: class com.pascal.lcltest.LCLActivity.LCLSurface
        canvasbitmap = Bitmap.createBitmap(lWidth, lHeight, Bitmap.Config.ARGB_8
888);
                       ^
src\com\pascal\lcltest\LCLActivity.java:114: method does not override or impleme
nt a method from a supertype
    @Override protected void onDraw(Canvas canvas)
    ^
src\com\pascal\lcltest\LCLActivity.java:145: cannot find symbol
symbol  : variable super
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      super.onKeyDown(keyCode, event);
      ^
src\com\pascal\lcltest\LCLActivity.java:146: cannot find symbol
symbol  : variable KeyEvent
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      int eventResult = LCLOnKey(KeyEvent.ACTION_DOWN, keyCode, event, (char) 0)
;
                                 ^
src\com\pascal\lcltest\LCLActivity.java:142: method does not override or impleme
nt a method from a supertype
    @Override public boolean onKeyDown (int keyCode, KeyEvent event)
    ^
src\com\pascal\lcltest\LCLActivity.java:154: cannot find symbol
symbol  : variable KeyEvent
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      int eventResult = LCLOnKey(KeyEvent.ACTION_UP, keyCode, event, event.getUn
icodeChar());
                                 ^
src\com\pascal\lcltest\LCLActivity.java:158: cannot find symbol
symbol  : variable super
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      super.onKeyUp(keyCode, event);
      ^
src\com\pascal\lcltest\LCLActivity.java:162: cannot find symbol
symbol  : method finish()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
        finish();
        ^
src\com\pascal\lcltest\LCLActivity.java:171: cannot find symbol
symbol  : variable KeyEvent
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      if (keyCode == KeyEvent.KEYCODE_MENU)
                     ^
src\com\pascal\lcltest\LCLActivity.java:174: cannot find symbol
symbol  : method closeOptionsMenu()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
        if (flagIsMenuOpen) closeOptionsMenu();
                            ^
src\com\pascal\lcltest\LCLActivity.java:175: cannot find symbol
symbol  : method openOptionsMenu()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
        else openOptionsMenu();
             ^
src\com\pascal\lcltest\LCLActivity.java:151: method does not override or impleme
nt a method from a supertype
    @Override public boolean onKeyUp (int keyCode, KeyEvent event)
    ^
src\com\pascal\lcltest\LCLActivity.java:185: cannot find symbol
symbol  : method postInvalidate()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      if ((eventResult | 1) != 0) postInvalidate();
                                  ^
src\com\pascal\lcltest\LCLActivity.java:182: method does not override or impleme
nt a method from a supertype
    @Override public boolean onTouchEvent (MotionEvent event)
    ^
src\com\pascal\lcltest\LCLActivity.java:193: cannot find symbol
symbol  : variable InputType
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      outAttrs.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
                           ^
src\com\pascal\lcltest\LCLActivity.java:194: cannot find symbol
symbol  : variable EditorInfo
location: class com.pascal.lcltest.LCLActivity.LCLSurface
      outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
                            ^
src\com\pascal\lcltest\LCLActivity.java:189: method does not override or impleme
nt a method from a supertype
    @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs
)
    ^
src\com\pascal\lcltest\LCLActivity.java:198: method does not override or impleme
nt a method from a supertype
    @Override public boolean onCheckIsTextEditor()
    ^
src\com\pascal\lcltest\LCLActivity.java:220: operator != cannot be applied to co
m.pascal.lcltest.LCLActivity.LCLSurface,<nulltype>
    if (((eventResult & 1) != 0) && (lclsurface != null)) lclsurface.postInvalid
ate();
                                                ^
src\com\pascal\lcltest\LCLActivity.java:220: cannot find symbol
symbol  : method postInvalidate()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
    if (((eventResult & 1) != 0) && (lclsurface != null)) lclsurface.postInvalid
ate();
                                                                    ^
src\com\pascal\lcltest\LCLActivity.java:231: cannot find symbol
symbol  : variable super
location: class com.pascal.lcltest.LCLActivity
    super.onCreate(savedInstanceState);
    ^
src\com\pascal\lcltest\LCLActivity.java:234: cannot find symbol
symbol  : method setContentView(com.pascal.lcltest.LCLActivity.LCLSurface)
location: class com.pascal.lcltest.LCLActivity
    setContentView(lclsurface);
    ^
src\com\pascal\lcltest\LCLActivity.java:235: cannot find symbol
symbol  : method postInvalidate()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
    lclsurface.postInvalidate();
              ^
src\com\pascal\lcltest\LCLActivity.java:238: cannot find symbol
symbol  : method getWidth()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
    lclformwidth = lclsurface.getWidth();
                             ^
src\com\pascal\lcltest\LCLActivity.java:239: cannot find symbol
symbol  : method getHeight()
location: class com.pascal.lcltest.LCLActivity.LCLSurface
    lclformheight = lclsurface.getHeight();
                              ^
src\com\pascal\lcltest\LCLActivity.java:242: cannot find symbol
symbol  : class DisplayMetrics
location: class com.pascal.lcltest.LCLActivity
    DisplayMetrics metrics = new DisplayMetrics();
    ^
src\com\pascal\lcltest\LCLActivity.java:242: cannot find symbol
symbol  : class DisplayMetrics
location: class com.pascal.lcltest.LCLActivity
    DisplayMetrics metrics = new DisplayMetrics();
                                 ^
[loading java\util\Collection.class(java\util:Collection.class)]
[loading java\lang\Iterable.class(java\lang:Iterable.class)]
[loading java\util\ArrayList.class(java\util:ArrayList.class)]
[loading java\lang\Exception.class(java\lang:Exception.class)]
[loading java\lang\Throwable.class(java\lang:Throwable.class)]
[loading java\util\AbstractList.class(java\util:AbstractList.class)]
[loading java\util\AbstractCollection.class(java\util:AbstractCollection.class)]

[loading java\lang\Comparable.class(java\lang:Comparable.class)]
[loading java\util\Map$Entry.class(java\util:Map$Entry.class)]
[loading java\util\Set.class(java\util:Set.class)]
[loading java\lang\CloneNotSupportedException.class(java\lang:CloneNotSupportedE
xception.class)]
[loading java\lang\System.class(java\lang:System.class)]
[loading java\lang\UnsatisfiedLinkError.class(java\lang:UnsatisfiedLinkError.cla
ss)]
[loading java\lang\LinkageError.class(java\lang:LinkageError.class)]
[loading java\lang\Error.class(java\lang:Error.class)]
[total 605ms]
Note: src\com\pascal\lcltest\LCLActivity.java uses unchecked or unsafe operation
s.
Note: Recompile with -Xlint:unchecked for details.
100 errors

C:\android\projects\androidlcl\android>REM DX to convert the java bytecode to da
lvik bytecode

C:\android\projects\androidlcl\android>call dx --dex --verbose --output=C:\andro
id\projects\androidlcl\android\bin\classes.dex C:\android\projects\androidlcl\an
droid\bin\classes
no classfiles specified

C:\android\projects\androidlcl\android>REM Now build the unsigned APK

C:\android\projects\androidlcl\android>del C:\android\projects\androidlcl\androi
d\bin\lcltest-unsigned.apk

C:\android\projects\androidlcl\android>call apkbuilder C:\android\projects\andro
idlcl\android\bin\lcltest-unsigned.apk -v -u -z C:\android\projects\androidlcl\a
ndroid\bin\lcltest.ap_ -f C:\android\projects\androidlcl\android\bin\classes.dex


THIS TOOL IS DEPRECATED. See --help for more information.

java.io.FileNotFoundException: C:\android\projects\androidlcl\android\bin\lcltes
t.ap_ does not exist
Impossible de trouver C:\android\projects\androidlcl\android\bin\lcltest-unalign
ed.apk
jarsigner: unable to open jar file: bin\lcltest-unsigned.apk
Unable to open 'bin\lcltest-unaligned.apk' as zip archive
Appuyez sur une touche pour continuer...

Any help is appreciated. Thanks in advance.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: kitsaros on April 09, 2014, 01:34:01 am
Thanks cronos for your time adding it at wiki.
@Sibylla
Your liblclapp.so was 5.073 kb?
You got correctly the LCLDebugKey.keystore ?
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: Sibylla on April 09, 2014, 08:11:50 pm
Hi @Kitsaros, My liblclapp.so is 5.072 Ko in the file manager (when I right-click on Properties, I get: 5 193 728 bytes on disk).
I suppose I also got correctly the LCLDebugKey.keystore file (2 Ko according to the file manager ; 4 096 bytes on disk when I right-click on properties).
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: kitsaros on April 14, 2014, 12:17:33 am
you are pretty close ! It must be something really easy .
Try recontrolling the paths at build_debug_apk.bat and running it as admin 
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: Sibylla on April 15, 2014, 08:37:17 pm
Yes ! One path was erroneous: i changed it to the correct path: build-tools\19.0.3\
and now it works well. Thank you !
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: kitsaros on May 10, 2014, 08:11:56 pm
Excellent news !  ;)
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: nsunny on July 19, 2014, 10:19:43 am
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 also got similar messeges. But I found a way in the wiki:
http://wiki.freepascal.org/fpcup#Android_ARM_crosscompiler

Copying the files to appropriate places gave me successful compile!
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: mirce.vladimirov on July 19, 2014, 04:57:02 pm
Since I am complete newbie to Android I just loved the possibility of creating android applications with lazarus but i keep getting this message :
"Failed to build APK <prv>. Please start the batch-file <c:\laztoapk\proekti\prv\build_debug_apk.bat> manually and analyze the output." .
Here follows the output.

Code: [Select]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Cloneable.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/io/Serializable.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/util/AbstractMap.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/SimpleAdapter.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/Filterable.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/BaseAdapter.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/ListAdapter.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/Adapter.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/SpinnerAdapter.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/view/ViewGroup.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Override.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/annotation/Annotation.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/SuppressWarnings.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/annotation/Target.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/annotation/ElementType.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/annotation/Retention.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/annotation/RetentionPolicy.class)]]
[checking com.pascal.prv.LCLActivity]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Error.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/pm/PackageManager.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/pm/PackageManager$NameNotFoundExcepti
on.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/util/AndroidException.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Exception.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Throwable.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/RuntimeException.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/IntentSender.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/IntentSender$SendIntentException.clas
s)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/io/IOException.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/io/FileNotFoundException.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/AutoCloseable.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Integer.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Number.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/util/Log.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/graphics/Bitmap$Config.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/graphics/Rect.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Comparable.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/text/InputType.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/util/DisplayMetrics.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/view/WindowManager.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/view/ViewManager.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/view/Display.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/view/MenuItem$OnMenuItemClickListener.class)]
]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/graphics/Paint.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/graphics/Paint$FontMetrics.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/graphics/Color.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/DialogInterface.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/DialogInterface$OnClickListener.class
)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/DialogInterface$OnCancelListener.clas
s)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/app/Dialog.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/util/Collection.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/Iterable.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/view/inputmethod/InputMethodManager.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/os/IBinder.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/hardware/SensorListener.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/app/PendingIntent.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/BroadcastReceiver.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/content/IntentFilter.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/util/ArrayList.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/ListView.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/util/AbstractList.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/util/AbstractCollection.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/R.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/R$layout.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/R$id.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/AbsListView.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/AdapterView.class)]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/widget/AdapterView$OnItemClickListener.class)
]]
[loading ZipFileIndexFileObject[c:\laztoapk\downloads\android-sdk-windows\platfo
rms\android-14\android.jar(android/view/ViewParent.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/util/Map$Entry.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/util/Set.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/CloneNotSupportedException.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/System.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/UnsatisfiedLinkError.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/LinkageError.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/StringBuilder.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/AbstractStringBuilder.class)]]
[loading ZipFileIndexFileObject[C:\Program Files\Java\jdk1.7.0_25\lib\ct.sym(MET
A-INF/sym/rt.jar/java/lang/StringBuffer.class)]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$LCLInputConnection.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$LCLSurface.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$1.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$2.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$3.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$LCLRunnable.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$4.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$5.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$6.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$7.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$8.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$LCL_ListViewItem.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity$LCL_ListViewAdapter.class]]
[wrote RegularFileObject[C:\laztoapk\proekti\prv\android\bin\classes\com\pascal\
prv\LCLActivity.class]]
[total 675ms]
Note: C:\laztoapk\proekti\prv\android\src\com\pascal\prv\LCLActivity.java uses u
nchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning

C:\laztoapk\proekti\prv\android>REM pause

C:\laztoapk\proekti\prv\android>REM DX to convert the java bytecode to dalvik by
tecode

C:\laztoapk\proekti\prv\android>call java -Djava.ext.dirs="c:\laztoapk\downloads
\android-sdk-windows"\platform-tools\lib\ -jar "c:\laztoapk\downloads\android-sd
k-windows"\build-tools\18.1.1\lib\dx.jar --dex --verbose --output=C:\laztoapk\pr
oekti\prv\android\bin\classes.dex C:\laztoapk\proekti\prv\android\bin\classes
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$1.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$2.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$3.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$4.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$5.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$6.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$7.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$8.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$LCLInputConnection.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$LCLRunnable.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$LCLSurface.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$LCL_ListViewAdapter.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity$LCL_ListViewItem.class...
processing C:\laztoapk\proekti\prv\android\bin\classes\.\com\pascal\prv\LCLActiv
ity.class...

C:\laztoapk\proekti\prv\android>REM pause

C:\laztoapk\proekti\prv\android>REM It seams that dx calls echo off

C:\laztoapk\proekti\prv\android>REM Now build the unsigned APK

C:\laztoapk\proekti\prv\android>del C:\laztoapk\proekti\prv\android\bin\prv-unsi
gned.apk

C:\laztoapk\proekti\prv\android>call java -classpath "c:\laztoapk\downloads\andr
oid-sdk-windows"\tools\lib\sdklib.jar com.android.sdklib.build.ApkBuilderMain C:
\laztoapk\proekti\prv\android\bin\prv-unsigned.apk -v -u -z C:\laztoapk\proekti\
prv\android\bin\prv.ap_ -f C:\laztoapk\proekti\prv\android\bin\classes.dex

THIS TOOL IS DEPRECATED. See --help for more information.

Packaging prv-unsigned.apk
C:\laztoapk\proekti\prv\android\bin\prv.ap_:
=> lib/armeabi/liblclapp.so
=> AndroidManifest.xml
=> resources.arsc
=> res/drawable-hdpi/icon.png
=> res/drawable-hdpi/lazarus.png
=> res/drawable-ldpi/icon.png
=> res/drawable-ldpi/lazarus.png
=> res/drawable-mdpi/icon.png
=> res/drawable-mdpi/lazarus.png
C:\laztoapk\proekti\prv\android\bin\classes.dex => classes.dex

C:\laztoapk\proekti\prv\android>REM pause

C:\laztoapk\proekti\prv\android>REM Generating on the fly a debug key

C:\laztoapk\proekti\prv\android>REM Signing the APK with a debug key

C:\laztoapk\proekti\prv\android>del C:\laztoapk\proekti\prv\android\bin\prv-unal
igned.apk

C:\laztoapk\proekti\prv\android>jarsigner -verbose -keystore C:\laztoapk\proekti
\prv\android\bin\LCLDebugKey.keystore -sigalg MD5withRSA -digestalg SHA1 -keypas
s test12 -storepass test12 -signedjar C:\laztoapk\proekti\prv\android\bin\prv-un
aligned.apk C:\laztoapk\proekti\prv\android\bin\prv-unsigned.apk LCLDebugKey
   adding: META-INF/MANIFEST.MF
   adding: META-INF/LCLDEBUG.SF
   adding: META-INF/LCLDEBUG.RSA
  signing: lib/armeabi/liblclapp.so
  signing: AndroidManifest.xml
  signing: resources.arsc
  signing: res/drawable-hdpi/icon.png
  signing: res/drawable-hdpi/lazarus.png
  signing: res/drawable-ldpi/icon.png
  signing: res/drawable-ldpi/lazarus.png
  signing: res/drawable-mdpi/icon.png
  signing: res/drawable-mdpi/lazarus.png
  signing: classes.dex

C:\laztoapk\proekti\prv\android>REM Align the final APK package

C:\laztoapk\proekti\prv\android>zipalign -v 4 C:\laztoapk\proekti\prv\android\bi
n\prv-unaligned.apk C:\laztoapk\proekti\prv\android\bin\prv.apk
'zipalign' is not recognized as an internal or external command,
operable program or batch file.

C:\laztoapk\proekti\prv\android>REM call and pause together allow us to see the
results in the end

C:\laztoapk\proekti\prv\android>REM pause

C:\laztoapk\proekti\prv\android>

At the end lines I can see some complains about a thing "zipalign". Could that be the thing and what is it anyway ?


EDIT: I found a file zipalign.exe on a subdir of my SDK instalation dir, "android-sdk-windows\build-tools\19.1.0" so I changed the version of "SDK Build Tool" from 18.0.1 to 19.1.0, see attached picture. And now it works. Whats this 18.0.1 and 19.1.0 thing ? What are these numbers mean ?
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: GreatDayDan on February 11, 2015, 12:07:28 pm
I have completed the first 5 step using current versions of the packages. (Java 8, Android-SDK r24.o2, NDK r10d, Laz4Android1.1-41139-FPC2.7.1)
But the build.bat does not create lazarus.exe.

Edit the file W:\Android\laz4android\build.bat like this :
SET FPC_BIN_PATH=W:\Android\laz4android
Run build.bat (doubleclick) ->  It will compile & bulid lazarus.

I captured a log of the build steps. I do not see any errors, exceptions or failures except for the final strip commands. Says file not found.

Any ideas on how to get this to work?

Thanks...Dan'l

I have Win8.1.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: truetom on February 12, 2015, 09:23:51 am
I have completed the first 5 step using current versions of the packages. (Java 8, Android-SDK r24.o2, NDK r10d, Laz4Android1.1-41139-FPC2.7.1)
But the build.bat does not create lazarus.exe.

Edit the file W:\Android\laz4android\build.bat like this :
SET FPC_BIN_PATH=W:\Android\laz4android
Run build.bat (doubleclick) ->  It will compile & bulid lazarus.

I captured a log of the build steps. I do not see any errors, exceptions or failures except for the final strip commands. Says file not found.

Any ideas on how to get this to work?

Thanks...Dan'l

I have Win8.1.

Hello ,
I think you can try new laz4android from here:http://sourceforge.net/projects/laz4android/files/?source=navbar (http://sourceforge.net/projects/laz4android/files/?source=navbar)
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: WickedDum on February 12, 2015, 08:46:07 pm
All of this info is GREAT!  But...I am traveling with my SAMSUNG Note 10.1.  Android 4.4.2.  Any tutorials for using Lazarus on Android?  Tx!
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: alireza.2 on April 25, 2015, 07:56:45 pm
Hello dear Community,

I need your Help, I had done everything that is written in the Tutorial, but I get this Error:
Quote
Messages, Warnings: 1
Warning: other sources path of package "lnetbase 0.6.5" contains directory "..\lib", which is already in the unit search path.
Compile package lnetvisual 0.6.5: Exit code 1, Errors: 6
lclnet.pas(45,15) Error: Forward declaration not solved "HandleIgnoreError(TLHandle);"
lclnet.pas(46,15) Error: Forward declaration not solved "HandleIgnoreWrite(TLHandle);"
lclnet.pas(47,15) Error: Forward declaration not solved "HandleIgnoreRead(TLHandle);"
lclnet.pas(48,15) Error: Forward declaration not solved "InternalUnplugHandle(TLHandle);"
lclnet.pas(50,15) Error: Forward declaration not solved "HandleEvents(LongInt;LongWord);"
lclnet.pas(58,14) Error: Forward declaration not solved "AddHandle(TLHandle):Boolean;"


I hope you can help me.

Thank You.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: magleft on June 26, 2015, 07:03:30 pm
Hello to All.

Perhaps my question is dumb or off-topic.

I have made an application that uses a sqlite database .
Now I want to convert the application on android and consider using laz4android.

In the past I tried laz4andoid but I was hard and in the end was not able to connect to the database.

I would like to ask what database I could use so I my application to "run" in android and communicate with the data using my existing application

Thanks in advance
any assistance granted
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: rx3.fireproof on June 26, 2015, 08:14:48 pm
@magleft

With the Android Module Wizard  it's easy.
Previously posted a link to a demo of my program with the database. (windows to android).
Can put more. There are bugs, but the program works.
In the full version of another code. Fix Demo will not.
I have a new version of java 1.8.45. The paths to fix don't want to.
Customdraw I did not like, not functionally. ( I was able to do only "Hello word" with Android 8. :D) 
But I'm not a programmer. I don't know much.

With Respect

rx3.fireproof
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: magleft on June 27, 2015, 09:26:08 pm
@rx3
Thanks for your answer. I will try.
Best Regards
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: ryan103 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.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: DelphiFreak on August 28, 2016, 07:01:32 pm
Thank you for this problem report. I will have a look into this.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 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.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: majid.ebru on February 12, 2017, 11:38:22 pm
see this
http://forum.lazarus.freepascal.org/index.php/topic,35601.msg236678.html#msg236678 (http://forum.lazarus.freepascal.org/index.php/topic,35601.msg236678.html#msg236678)
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 on February 13, 2017, 02:11:53 pm
Yeah man! It's working! Thank you.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 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?
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: jmpessoa on February 26, 2017, 05:38:01 am

Hi, axel234

Are You mixing "Custom Drawn" framework with LAMW framework?
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 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.  
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: Thaddy 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.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 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?
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: Thaddy 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.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: jmpessoa 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.

Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 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!
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: jmpessoa 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


Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 on February 26, 2017, 07:51:20 pm
Originally in AndroidManifest.xml the SDK line is:
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14"/>

and in Build.xml the SDK line is:
<property name="target"  value="android-14"/>

I've tried this:

Changing the first line to:
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="14"/>
then build. I got an error message.

Then changing the first line to:
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17"/>
Error.

Then changing the first line to:
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="14"/>
AND the build.xml line to:
<property name="target"  value="android-17"/>
Error occured.

Then, the first line to:
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17"/>
AND the build.xml line to:
<property name="target"  value="android-17"/>

Unfortunatelly I got an error message as well.

Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: jmpessoa on February 26, 2017, 08:17:16 pm


Please, try a new project!!

Set minSdk = 17

and set tarqet to some >= 17

[While I'm here correcting the framework  to it work when api < 17!  :-X]

Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 on February 26, 2017, 08:52:41 pm
Each try I made, was on the new project.

Ok, so I'll wait for you to finish the api work.
Please post here the corrected framework.

Thank you very much for your help.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: jmpessoa on February 26, 2017, 09:33:26 pm


After fix the minSdk and Target Api.... what is your message error?
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: axel234 on February 26, 2017, 11:02:32 pm
I've tried again, not by editing any of the .xml files manually, but selecting the MinSdkApi 14 and TargetSdkApi 19 in Module Wizard while creating a new project and it looks like it's working fine :)
Lately when I was editing the .xml files manually according to your instructions, I wasn't changing anything in Module Wizard while creating a new project (because you didn't tell me to), and that was in my opinion causing errors.

PS If my English is poor, sorry for that, I'm Polish.
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: jmpessoa on February 26, 2017, 11:38:46 pm

Ok!

The question was just minSdk =  14  !!! Some component work
only for minSdk >= 17

[but I will Fix it now!]

Thank you!
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: apexcol on June 24, 2017, 04:49:43 am
Hi, did anyone install Android to work with Lazarus on Ubuntu?  Any place where to get info on doing that step-by-step? ::)
Title: Re: Tutorial - Android & Lazarus for novices like me
Post by: jmpessoa on June 25, 2017, 07:44:28 pm

You can try  [LAMW]  "how to"  for linux   [by renabor]

https://github.com/jmpessoa/lazandroidmodulewizard/tree/master/docs/linux
TinyPortal © 2005-2018