AndroidManifest template problem/confusion

Values of AndroidManifest-Template are ignored, except some special settings like “uses-feature … required=false” which make it into the final app.
Most “base-values” get ignored and come from somewhere else.

Example:

Androidmanifest Template:
  <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="777" android:versionName="1.2.5" ...>
  <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22"/>

project.xml
  <android min-sdk-version="7" />
  <meta title="TestApp" version="1.2.0" ..../>

Result:
  aapt dump badging app.apk 
    package: versionCode='5' versionName='1.2.0' 
    sdkVersion:'9'
    targetSdkVersion:'19'

VersionCode:
ignores the value of AndroidManifest
cant figure out how i can set it

Versionname:
Project.xml overwrites the value in Androidmanifest.

minSdkVersion:
ignores the value of AndroidManifest
ignores the value of Project.xml
always 9, cant figure out how i can set it

targetSdkVersion:
ignores the value of AndroidManifest
if i add it to the Project.xml it is used, else 19

I always thought that the values in AndroidManifest are the “final” values - ie. overwriting all other/previous values.
Or, what could be the reason for those “base-values” being ignored/overwritten?

If i use
<template  path="g-manifests/template-a.xml" rename="app/src/main/AndroidManifest.xml" />
or
<template path="templates" /> - with a folder structure like (android/template/app/src/main/AndroidManifest.xml) inside
doesnt change the result.

:confused:
(I probably have this problem since the change to Openfl4)

I dont get the Manifest-Merging.
My template-android-manifest ends up in Export/android/release/bin/app/src/main/ with all its values.

ManifestmergerReport reports “merging” 3-times the same file!?

android:versionName
  ADDED    from /DisplayingABitmap/Export/android/release/bin/app/src/main/AndroidManifest.xml:2:142-169
  INJECTED from /DisplayingABitmap/Export/android/release/bin/app/src/main/AndroidManifest.xml
  INJECTED from /DisplayingABitmap/Export/android/release/bin/app/src/main/AndroidManifest.xml

Still, the Manifest-template-values get overwritten by the different values from “gradle.properties”

For now my workaround, to set all base values is another template:

<template path="test/gradle.properties" rename="gradle.properties" />

Thats the only way i could find to set/force the 'versionCode".

… but i dont think that is the intended way.

What is the proper way to set the versionCode?

You can sort of tell what the project.xml values are by looking at the original “gradle.properties” file, before it has been processed:

versionCode is automatically generated, based on the number of builds you have done for your project. Otherwise you can override using <meta build-number="1000" /> or you can also do things like <meta build-number="git" /> and <meta build-number="git+1000" /> if the project is under version control

Android build target SDK version is <config:android target-sdk-version="" /> and build min SDK version is <config:android minimum-sdk-version="" />, if I remember correctly

1 Like