Recent

Author Topic: [SOLVED] LAMW: Older API support (need API 13)  (Read 5287 times)

tk

  • Sr. Member
  • ****
  • Posts: 361
[SOLVED] LAMW: Older API support (need API 13)
« on: November 15, 2016, 02:38:27 pm »
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
« Last Edit: November 17, 2016, 09:38:32 pm by tk »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: LAMW: Older API support (need API 13)
« Reply #1 on: November 15, 2016, 05:05:17 pm »
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!!!!
« Last Edit: November 15, 2016, 06:34:12 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

tk

  • Sr. Member
  • ****
  • Posts: 361
Re: LAMW: Older API support (need API 13)
« Reply #2 on: November 15, 2016, 10:44:40 pm »
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!

2. 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

  • Hero Member
  • *****
  • Posts: 2301
Re: LAMW: Older API support (need API 13)
« Reply #3 on: November 16, 2016, 12:20:06 am »
About:
Quote
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'.

Please,  try edit/change
Quote
android:Theme.DeviceDefault
to
Quote
android:Theme.Light

[EDITED]
and delete folder     "....res/values-v21"
« Last Edit: November 16, 2016, 01:28:11 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: LAMW: Older API support (need API 13)
« Reply #4 on: November 16, 2016, 01:38:42 am »
Quote
About:
Quote
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'.

Please,  try edit/change
Quote
android:Theme.DeviceDefault
to
Quote
android: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
« Last Edit: November 16, 2016, 01:54:01 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: LAMW: Older API support (need API 13)
« Reply #5 on: November 16, 2016, 03:17:08 am »
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



« Last Edit: November 16, 2016, 03:37:34 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

tk

  • Sr. Member
  • ****
  • Posts: 361
Re: LAMW: Older API support (need API 13)
« Reply #6 on: November 17, 2016, 09:38:18 pm »
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]
<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="13"/>build.xml:
Code: [Select]
<property name="target"  value="android-13"/>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...

« Last Edit: November 18, 2016, 10:18:52 pm by tk »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: [SOLVED] LAMW: Older API support (need API 13)
« Reply #7 on: November 20, 2016, 04:25:20 pm »


Quote
although it should IMO ignore the files in values-v14 and values-v21 folders...

Delete the folder  values-v21  [and values-v14?] ....
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

tk

  • Sr. Member
  • ****
  • Posts: 361
Re: [SOLVED] LAMW: Older API support (need API 13)
« Reply #8 on: November 21, 2016, 01:30:22 am »
Delete 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.

 

TinyPortal © 2005-2018