[SOLVED] LAMW: Older API support (need API 13) lazarus / 43-Android ---------------------------------------------------------------------- tk · 2016-11-15 13:38 Hi jmpessoa, is there possibility to select API 13 compat. level? We need to build for a GT-P6800 which has Android 3.2 and there is no way to upgrade (dev. is only 3,5 years old, not even listed on Samsung pages...). Tried to set min SDK and target SDK to 13, downloaded API13 in SDK manager but javac reports many PANICs. Our older SW created in Java ADK normally runs there. Thanks ---------------------------------------------------------------------- jmpessoa · 2016-11-15 16:05 Yes. 1. Besides setting up the "AndroidManifest.xml" you need change "build.xml", too. 2. After, [maybe] we need to do some "lifting" in java code/templates ... [what components are  you  using?] EDITED!  change "project.properties",  too!!!! ---------------------------------------------------------------------- tk · 2016-11-15 21:44 Did what you said and got: Code: [Select]Messages, Hints: 2 Note: Duplicate unit "controls" in "controls", orphaned ppu "C:\lamw\Project\obj\controls\controls.o" Note: Duplicate unit "controls" in "LCLBase 1.5", ppu="C:\lamw\Laz4Android\lcl\units\arm-android\controls.ppu", source="C:\lamw\Laz4Android\lcl\controls.pp" Compile Project, OS: android, CPU: arm, Target: C:\lamw\Project\libs\armeabi-v7a\libcontrols.so: Success Building APK... : Exit code 1, Errors: 82 Panic: Buildfile: C:\lamw\Project\build.xml Panic: Panic: -check-env: Panic:  [checkenv] Android SDK Tools Revision 24.4.1 Panic:  [checkenv] Installed at C:\lamw\android-sdk-windows Panic: Panic: -setup: Panic:      [echo] Project Name: LamwGUIProject1 Panic:   [gettype] Project Type: Application Panic: Panic: -pre-clean: Panic: Panic: clean: Panic:    [delete] Deleting directory C:\lamw\Project\bin Panic:    [delete] Deleting directory C:\lamw\Project\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 24.4.1 Panic:  [checkenv] Installed at C:\lamw\android-sdk-windows Panic: Panic: -setup: Panic:      [echo] Project Name: LamwGUIProject1 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: 25.0.0 Panic:      [echo] Resolving Build Target for LamwGUIProject1... Panic: [gettarget] Project Target:   Android 3.2 Panic: [gettarget] API level:        13 Panic:      [echo] ---------- Panic:      [echo] Creating output directories if needed... Panic:     [mkdir] Created dir: C:\lamw\Project\bin Panic:     [mkdir] Created dir: C:\lamw\Project\bin\res Panic:     [mkdir] Created dir: C:\lamw\Project\bin\rsObj Panic:     [mkdir] Created dir: C:\lamw\Project\bin\rsLibs Panic:     [mkdir] Created dir: C:\lamw\Project\gen Panic:     [mkdir] Created dir: C:\lamw\Project\bin\classes Panic:     [mkdir] Created dir: C:\lamw\Project\bin\dexedLibs Panic:      [echo] ---------- Panic:      [echo] Resolving Dependencies for LamwGUIProject1... Panic: [dependency] Ordered libraries: Panic: [dependency] Panic: [dependency] ------------------ Panic: [dependency] API<=15: Adding annotations.jar to the classpath. 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] C:\lamw\Project\res\values-v14\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.DeviceDefault'. Panic:      [aapt] Panic:      [aapt] C:\lamw\Project\res\values-v21\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.DeviceDefault'. Panic:      [aapt] Panic: Panic: BUILD FAILED Panic: C:\lamw\android-sdk-windows\tools\ant\build.xml:649: The following error occurred while executing this line: Panic: C:\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! Quote from: jmpessoa on November 15, 2016, 05:05:17 pm2. After, [maybe] we need to do some "lifting" in java code/templates ... [what components are  you  using?] Now only jButton, jEditText, jTextView, jPanel, jProgressBar, jTimer and jScrollView. Later probably jMenu and jContextMenu, don't know exactly which. Thanks ---------------------------------------------------------------------- jmpessoa · 2016-11-15 23:20 About: QuotePanic:      [aapt] C:\lamw\Project\res\values-v14\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.DeviceDefault'. Please,  try edit/change Quoteandroid:Theme.DeviceDefault to Quoteandroid:Theme.Light [EDITED] and delete folder     "....res/values-v21" ---------------------------------------------------------------------- jmpessoa · 2016-11-16 00:38 QuoteAbout: QuotePanic:      [aapt] C:\lamw\Project\res\values-v14\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.DeviceDefault'. Please,  try edit/change Quoteandroid:Theme.DeviceDefault to Quoteandroid:Theme.Light [EDITED] and delete folder     "....res/values-v21" In Attachments there are "Controls.java" and "jCommons.java" modified to support  API 13. Now we need put [one a one] and test others components! EDITED: In all ".java" component template we need change: Gravity.START      to    Gravity.LEFT            and Gravity.END          to    Gravity.RIGHT ---------------------------------------------------------------------- jmpessoa · 2016-11-16 02:17 Ok. In Attachment there is some stuff/template API 13 compatible. [no problem with jTime, jMenu, jContextMenu] NOTE 1: You can use some "diff" tool to perceive the changes "pattern"  and modify others... NOTE 2. Here is my API 13 complete project [OpenDrive]:  https://od.lk/f/Ml8xMjU1NzE4MjRf ---------------------------------------------------------------------- tk · 2016-11-17 20:38 So finally I could run the same app on my API 13 device (Android 3.2). Marking this issue as solved. Thank you. Only for my API 18 device (Android 4.3) I can call LoadLibrary for my custom libraries in TAndroidModule1.AndroidModule1Create and in API 13 I can't. Don't know why but the app freezes. I could fix this by adding the library loads to TAndroidModule1.AndroidModule1CreateOptionMenu. Is there some way how to conditionally define the API level in the java sources, to skip unsupported things? Commented out code is not very nice for generating a patch. I made some other changes eg. for jCustomDialog etc. (and possibly will make more in future). So I can send you patch(es) then. EDIT: Ok I made changes according to this https://community.oracle.com/blogs/schaefa/2005/01/20/how-do- conditional-compilation-java. From now on, basic preprocessing based on API level can be used for the java sources. I will send you a patch (+I repaired my previous patch). EDIT2: Still not fully understand why I get the resource compiler errors. Everything should be correct AndroidManifext.xml: Code: [Select]build.xml: Code: [Select]Despite that aapt returns these errors (Panic:      [aapt] C:\lamw\projects\LamwGUIProject1\res\values-v14\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.DeviceDefault'.) although it should IMO ignore the files in values-v14 and values-v21 folders... ---------------------------------------------------------------------- jmpessoa · 2016-11-20 15:25 Quote although it should IMO ignore the files in values-v14 and values-v21 folders... Delete the folder  values-v21  [and values-v14?] .... ---------------------------------------------------------------------- tk · 2016-11-21 00:30 Quote from: jmpessoa on November 20, 2016, 04:25:20 pmDelete the folder  values-v21  [and values-v14?] .... Nope, the point is how to use Holo.Light on old device and DeviceDefault on new device, with the same apk. The folders should be there, they are well defined as they recommend on Android developer portal. It should work but does not for me, will try to find out later what's wrong.