jmpessoa / lazandroidmodulewizard

LAMW: Lazarus Android Module Wizard: Form Designer and Components development model!
253 stars 83 forks source link

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

Closed maxxir closed 7 years ago

maxxir commented 7 years ago

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

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

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

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

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

jmpessoa commented 7 years ago

Hello!

Can you find "color.xml" in your project folder "....res\values" ???

[and what your project "minSDk" and "targetSDK" ??? ]

maxxir commented 7 years ago

Yes "res\values\colors.xml" present, with content:

<resources>
  <color name="primary">#3F51B5</color>
  <color name="primary_dark">#303F9F</color>
  <color name="primary_light">#C5CAE9</color>
  <color name="accent">#03A9F4</color>
  <color name="primary_text">#212121</color>
  <color name="secondary_text">#727272</color>
  <color name="icons">#FFFFFF</color>
  <color name="divider">#B6B6B6</color>
</resources>

and from AndroidManifest.xml <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="17"/>

jmpessoa commented 7 years ago

Strange, you are using uses-sdk android:minSdkVersion="15" android:targetSdkVersion="17" then why this access to "......res\values-21" ??? in fact, in this condition I thought this access would not happen!

maxxir commented 7 years ago

I don't know too, very strange!

jmpessoa commented 7 years ago

Ok. I will roll back the styles in "values-21" until we find a solution to this problem ...

Thank you!

jmpessoa commented 7 years ago

Fixed! Thank you!

maxxir commented 7 years ago

Confirmed now works good!