如果我没有在我的Gluon项目中创建src/android/AndroidManifest.xml文件,那么mvn gluonfx:package命令将为我创建一个相对合理的默认设置。但是,我需要对我的应用程序生成的AndroidManifest.xml进行一些更改(例如表示对多个屏幕分辨率的支持,并需要添加计费权限)。
如果我按照gluonfx:package中的建议将生成的AndroidManifest.xml复制到src/android/AndroidManifest.xml中,那么Gluon将不再为我更新版本代码和版本号字段。我也不确定手工编辑AndroidManifest.xml文件是否还有其他副作用。
所以我的问题是:
发布于 2022-02-28 10:28:01
作为文档化的这里,您应该使用<releaseConfiguration/>来定义每个新版本所需或需要更新的值。
对于安卓,除了keystore签名属性之外,还可以定义:
像这样:
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.maven.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<releaseConfiguration>
<versionCode>2</versionCode>
<versionName>3.0</versionName>
<appLabel>MyHelloFX</appLabel>
</releaseConfiguration>
...因此,如果您需要将AndroidManifest添加到src/Android (在target/gluonfx/aarch64-android/gensrc/android/AndroidManifest.xml中生成的),为了添加/修改其中的一部分,无论何时在pom中更改它们,都会对这三个值进行更新。
关于CI/CD,请看一下HelloGluon CI示例。
它没有自定义清单,但它展示了如何在CI环境中处理ReleaseConfiguration和更新发布值。
pom定义了releaseConfiguration块使用的一些属性:
<properties>
...
<main.class>com.gluonhq.hello.HelloGluonApp</main.class>
<app.identifier>${main.class}</app.identifier>
<app.description>The HelloGluon app</app.description>
<version.code/>
<provided.keystore.path/>
</properties>
...
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.maven.plugin.version}</version>
<configuration>
...
<releaseConfiguration>
<vendor>Gluon</vendor>
<description>${app.description}</description>
<packageType>${package.type}</packageType>
<!-- for macOS/iOS -->
<macAppStore>${mac.app.store}</macAppStore>
<bundleShortVersion>${bundle.short.version}</bundleShortVersion>
<bundleVersion>${bundle.version}</bundleVersion>
<!-- for Android -->
<versionCode>${version.code}</versionCode>
<providedKeyStorePath>${provided.keystore.path}</providedKeyStorePath>
...这些属性最终是为每个配置文件定义的
<profile>
<id>android</id>
<properties>
<gluonfx.target>android</gluonfx.target>
<app.identifier>com.gluonhq.samples.hellogluon</app.identifier>
<version.code>${env.GITHUB_RUN_NUMBER}</version.code>
...在运行Android 工作时,将使用所需的变量和秘密:
- name: Gluon Build
run: mvn -Pandroid gluonfx:build gluonfx:package
env:
GLUON_ANDROID_KEYSTOREPATH: ${{ steps.android_keystore_file.outputs.filePath }}
...https://stackoverflow.com/questions/71291910
复制相似问题