如何解决使用 Gluon 客户端插件构建 APK - JDK 问题
我用来构建 APK 的项目是来自 gluon client samples 项目的 HelloFX 子项目。
我运行了 mvn client:runagent 然后 mvn client:build -P android。构建过程失败并显示以下错误语句。
[Thu Jun 03 10:00:02 IST 2021][INFO] [SUB] [hellofx.hellofx:2299] write: 545.55 ms,1.09 GB
[Thu Jun 03 10:00:02 IST 2021][INFO] [SUB] [hellofx.hellofx:2299] [total]: 168,663.25 ms,1.09 GB
[Thu Jun 03 10:00:02 IST 2021][INFO] [SUB] Warning: Image 'hellofx.hellofx' is a fallback image that requires a JDK for execution (use --no-fallback to suppress fallback image generation and to print more detailed information why a fallback image was necessary).
[Thu Jun 03 10:00:02 IST 2021][INFO] Additional information: Objectfile should be called hellofx.hellofx.o but we didn't find that under /home/manikandan/eclipse-workspace/HelloFX/target/client/aarch64-android/gvm
[Thu Jun 03 10:00:02 IST 2021][SEVERE] Compiling Failed.
Check the log files under /home/manikandan/eclipse-workspace/HelloFX/target/client/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/client/ for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:55 min
[INFO] Finished at: 2021-06-03T10:00:02+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.1.41:compile (default-cli) on project hellofx: Compiling Failed
可以在here找到完整的日志。
这是 pom.xml 文件。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hellofx</groupId>
<artifactId>hellofx</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HelloFX</name>
<properties>
<main.class>hellofx.HelloFX</main.class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>15.0.1</javafx.version>
<javafx.maven.plugin.version>0.0.5</javafx.maven.plugin.version>
<client.maven.plugin.version>0.1.41</client.maven.plugin.version>
<charm.version>6.0.6</charm.version>
<glisten.afterburner.version>2.0.5</glisten.afterburner.version>
<attach.version>4.0.10</attach.version>
<connect.version>2.0.1</connect.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<!-- Added jackson dependency here -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.1</version>
</dependency>
<!-- Added JavaTime data type -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.12.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.maven.plugin.version}</version>
<configuration>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
<version>${client.maven.plugin.version}</version>
<configuration>
<target>${client.target}</target>
<mainClass>${main.class}</mainClass>
<reflectionList>
<list>hellofx.Person</list>
<list>com.fasterxml.jackson.core.JsonFactory</list>
</reflectionList>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>desktop</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<client.target>host</client.target>
</properties>
</profile>
<profile>
<id>ios</id>
<properties>
<client.target>ios</client.target>
</properties>
</profile>
<profile>
<id>android</id>
<properties>
<client.target>android</client.target>
</properties>
</profile>
</profiles>
</project>
首先我发现 JDK 存在一些问题。所以我再次重新安装了 openjdk 11。但是,还是会出现这个问题。
我正在使用的 JDK,
manikandan@manikandan-VirtualBox:~/eclipse-workspace/HelloFX$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04,mixed mode,sharing)
manikandan@manikandan-VirtualBox:~/eclipse-workspace/HelloFX$ javac -version
javac 11.0.11
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。