Lazarus

Programming => Operating Systems => Android => Topic started by: amartitegui on November 14, 2017, 03:42:44 pm

Title: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: amartitegui on November 14, 2017, 03:42:44 pm
This is what i get. Please there is an error at the end. looks like is something about coloring.
Using Laz4android 1.7
LAWM
THANKS

Messages, Hints: 2
Verbose: Selected chip architecture: armeabi-v7a
Verbose: Taking libraries from folder: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\libs\armeabi-v7a
Verbose: Found library: libcontrols.so
Note: Duplicate unit "controls" in "controls", orphaned ppu "C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\obj\controls\controls.o"
Note: Duplicate unit "controls" in "LCLBase 1.7", ppu="C:\lamw\laz4android\lcl\units\arm-android\controls.ppu", source="C:\lamw\laz4android\lcl\controls.pp"
Hint: (11030) Start of reading config file C:\lamw\laz4android\fpc\3.1.1\bin\i386-win32\fpc.cfg
Hint: (11031) End of reading config file C:\lamw\laz4android\fpc\3.1.1\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 3.1.1 [2016/11/20] for arm
Copyright (c) 1993-2016 by Florian Klaempfl and others
(1002) Target OS: Android for ARMEL
(3104) Compiling controls.lpr
C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\jni\controls.lpr(474,39) Hint: (5024) Parameter "reserved" not used
C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\jni\controls.lpr(490,42) Hint: (5024) Parameter "reserved" not used
C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\jni\controls.lpr(7,31) Hint: (5023) Unit "And_jni_Bridge" not used in controls
(9009) Assembling controls
(9022) Compiling resource C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\obj\controls\controls.or
(9015) Linking C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\libs\armeabi-v7a\libcontrols.so

(1008) 576 lines compiled, 1.9 sec
(1022) 5 hint(s) issued
Buildfile: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\build.xml
     [copy] Copying 5 files to C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\src\org\lamw\lamwguiproject2\android-19

-check-env:
 [checkenv] Android SDK Tools Revision 25.2.5
 [checkenv] Installed at C:\lamw\android-sdk-windows

-setup:
     [echo] Project Name: LamwGUIProject2
  [gettype] Project Type: Application

-pre-clean:

clean:
   [delete] Deleting directory C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\bin
   [delete] Deleting directory C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\gen
[getlibpath] Library dependencies:
[getlibpath] No Libraries
   [subant] No sub-builds to iterate on

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 25.2.5
 [checkenv] Installed at C:\lamw\android-sdk-windows

-setup:
     [echo] Project Name: LamwGUIProject2
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 27.0.1
     [echo] Resolving Build Target for LamwGUIProject2...
[gettarget] Project Target:   Android 4.4.2
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\bin
    [mkdir] Created dir: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\bin\res
    [mkdir] Created dir: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\bin\rsObj
    [mkdir] Created dir: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\bin\rsLibs
    [mkdir] Created dir: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\gen
    [mkdir] Created dir: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\bin\classes
    [mkdir] Created dir: C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\bin\dexedLibs
     [echo] ----------
     [echo] Resolving Dependencies for LamwGUIProject2...
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [aapt] C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\res\values-v21\styles.xml:11: error: Error: No resource found that matches the given name: attr 'android:colorAccent'.
     [aapt]
     [aapt] C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\res\values-v21\styles.xml:9: error: Error: No resource found that matches the given name: attr 'android:colorPrimary'.
     [aapt]
     [aapt] C:\lamw\projects\ALFONSO_TEST_1\LamwGUIProject2\res\values-v21\styles.xml:10: error: Error: No resource found that matches the given name: attr 'android:colorPrimaryDark'.
     [aapt]

BUILD FAILED
C:\lamw\android-sdk-windows\tools\ant\build.xml:649: The following error occurred while executing this line:
C:\lamw\android-sdk-windows\tools\ant\build.xml:694: null returned: 1

Total time: 2 seconds
Exception, Errors: 1
Fatal: [Exception] Failed: Cannot build APK!
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: Handoko on November 14, 2017, 04:12:03 pm
You can try to use LazToApk, it will help you download, install and configure Laz4Android and other necessary things automatically.

More options, read here:
http://forum.lazarus.freepascal.org/index.php/topic,38777.msg264428.html#msg264428

Also read the first post of the thread on the link, you can learn how to install and use LAMW without Laz4Android.
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: amartitegui on November 14, 2017, 06:40:51 pm
Well thanks Handoko.
I allready tried Laztoapk, but does not work. At least not for me... and for what I read not just me.
When compiling there was no errors, but the apk looked just like the demo. even after clearing everything.
I read that was something happening to many people, so i dropped that solution.

What I don't really understand is for example the little project I wrote to test everything. Just a button, and a Tedit from android bridges.
Compiling says no errors.
The only problem I get is building APK.
as far as I see is there is some kind of error in xml file from apache ant.
Not sure if there si some missconfiguration or what. Just if u know where can the probem be...
thanks anyway.

Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: jmpessoa on November 14, 2017, 07:20:39 pm
Hello  amartitegui!

This bug was fixed some time ago.... have you an "up to date" LAMW stuff?

[if not, update LAMW and make a new project ... everything will work again ....]

The error is in ".....res/values/style.xml", for API < 21 we need a more simple style

like:

Code: [Select]
<resources>
    <!--
        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml and
        res/values-v14/styles.xml on API 21+ devices.
    -->
    <style name="AppBaseTheme" parent="dummyTheme">
      <!-- API 21 theme customizations can go here. -->
     
      <!--  <item name="android:colorPrimary">@color/primary</item>
        <item name="android:colorPrimaryDark">@color/primary_dark</item>
        <item name="android:colorAccent">@color/accent</item>
        <item name="android:textColorPrimary">@color/primary_text</item>
        <item name="android:textColorSecondary">@color/secondary_text</item>
        <item name="android:divider">@color/divider</item>
      -->
    </style>
</resources>

where the "colors" are commented!
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: Handoko on November 14, 2017, 07:38:17 pm
@amartitegui

Maybe you haven't known, LazToApk is a tool to automate the installation and configuration of Laz4Android. If the result of LazToApk fails, you probably will fail too using Laz4Android.

Luckily you can use LAMW + Lazarus only, without Laz4Android (to be more specific - CustomDrawn widgetset). To do so, you have to use the visual components provided by LAMW only, they are the ones started with 'j' (example: jButton, jPanel, etc).

The only problem I get is building APK.

To properly configure Laz4Android (or LAMW or Lazarus) you need to:
1. Download & install Android's SDK and NDK
2. Instal Ant, Java and some others if you use Linux
3. Set the paths according to the SDK, NDK, Ant, Java you installed
4. Set compiler parameters according to the SDK, NDK you downloaded
5. Cross compile your Lazarus/FPC to support Android ARM (or/and i386)

Android's toolchain is complicated and any minor mistake mentioned above will sure to fail to produce apk. Have you done the 5 things above correctly?

I managed to understand how to configure them manually and properly to target Android both ARM and i386. I saw you use Windows, unfortunately I'm a Linux user. Maybe you can get some idea how to configure them by reading this tutorial (Linux only):
http://forum.lazarus.freepascal.org/index.php/topic,38777.msg264419.html#msg264419
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: amartitegui on November 14, 2017, 07:49:34 pm
Handoko, Im gonna try also linux (ubuntu). I tried last week that i had a little spare time to try the bash script in github from jmpessoa.
It was almos.... but when it looked everything correct there is a little problem and cant launch lazarus IDE. i droped the try cause didnt have much time.
I have also tried with windows as u have seen... and I did all those 5 things.
The project compiles without complains. (just a button and a textbox (jtedit)).
Then I thought i had it working.... until tried to build apk and saw that build.xml failure matter.... And Im not sure either that it can be a problem of the crosscompiling... but again... shouldn't throw an error when compiling project?(thats why I dropped that posibility).
Im gonna give a try to your link and try with ubuntu again....
It s kinda tricky to get working lazarus with android.
thanks for your help and effords. U guys are doing an incredible job.
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: amartitegui on November 14, 2017, 08:39:54 pm
Uuuups I missed your previous answer about API<21.
Just read it. It sounds like that could be the problem. Will also check the LAWM upgrade.
Let u know tomorrow.
Thanks again man
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: amartitegui on November 15, 2017, 07:56:08 am
Aaaaah sorry It was JMpessoa the one answering about the .xml.
sorry guys. too many screens at the same time :-D
gonna try it out right away
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: amartitegui on November 15, 2017, 03:49:21 pm
BTW Handoko. Laztoapk ... you say its fixed?  with a new version?
I still see 0.9.0.37
it has been modified?
regards
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: amartitegui on November 15, 2017, 04:01:57 pm
AND YESSSSSSs
It worked.... Finally
now it works. u were rigth Jmpessoa. updating solved everything.

Thanks a lot guys.

Im gonna check out how does it works, and see.

guess graphical part is the most limited right? meaning about re-use laz programs I made, and units allready made ...
Ill check first.
thanks and regards
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: Handoko on November 15, 2017, 05:06:46 pm
BTW Handoko. Laztoapk ... you say its fixed?  with a new version?

Did I? Where?
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: DelphiFreak on November 15, 2017, 05:23:21 pm
Hello Handoko,

no there is no new version of laztoapk.
As you wrote before, laztoapk is just a "helper" install/setup/config this incredible tricky toolchain.

Since there is no progress on CustomDrawn Controls and no new version of Laz4Android, I am thinking of deleting the laztoapk project from sourceforge.

I anyway lost interest in android/lazarus approch. I bought delphi and it worked out of the box.  :D

Of course, lazarus is very ok for other things. But for android stuff???

Sam
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: Handoko on November 15, 2017, 05:39:14 pm
It's a sad news.

I've been waiting so long to use LazToApk + CustomDrawn, unfortunately no progress fixing the bug in CustomDrawn.

Have you tried LAMW, I have better luck with it. The installation and configuration of Lazarus + LAMW is not beginner friendly.

Your LazToApk really is an amazing tool, just some simple clicks, I can create apk. Please don't remove it soon, give CustomDrawn's developer some time. Or maybe consider to make it supports LAMW.

Lazarus + LAMW can do amazing things for Android platform. I'm now creating a simple but still looking good game to show the potential of Android games programming in Lazarus.
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: amartitegui on November 15, 2017, 05:41:42 pm
Yes Handoko. Finally gotit working. LAWM.
thx
Title: Re: New at Laz4Android...anyone could gimme a tip on this apk building error?
Post by: Handoko on November 15, 2017, 05:43:31 pm
Glad to hear you've managed to make it works.
TinyPortal © 2005-2018