在Android设备上安装gluonfx: Install命令失败,文件未找到



我正在我的Ubuntu 20.04桌面上使用Gluon的Gluon- mobile在线文档,用于Android平台。我试图直接从我的CLI(而不是从Eclipse)执行此指令。

要将应用程序安装到已连接的android设备上,请运行mvn -Pandroid gluonfx:install.

这让我很困惑,因为我不明白我连接到我的Ubuntu桌面(通过USB)的设备将如何被感知。我之前已经成功编译到Android设备,当使用AndroidStudio时,因为它有一个控件,允许人们选择连接的手机作为目标。

在运行命令时(考虑到我可能会被要求识别目标设备,或者它可能以某种方式被自动感知),我得到了以下异常:

phil@UbuntuDesktop:~/Projects/metronome/gluon-samples-master/HelloFX$ mvn -Pandroid gluonfx:install
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.gluonhq.samples:hellofx >---------------------
[INFO] Building HelloFX 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- gluonfx-maven-plugin:1.0.5:install (default-cli) @ hellofx ---
[Sat Sep 18 19:22:41 PDT 2021][INFO] ==================== INSTALL TASK ====================
java.io.IOException: Cannot run program "/home/phil/Projects/metronome/gluon-samples-master/HelloFX/target/gluonfx/aarch64-android/gvm/android_project/gradlew": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1142)

文件位置../HelloFX/target/gluonfx/aarch64-android/gvm只包含两个目录:/log/tmp. 没有gvm/android_project目录或gradlew文件。该目录中的日志文件保存有关运行的以下信息:

[Sat Sep 18 19:22:41 PDT 2021][FINE] PB Command for install-task: /home/phil/Projects/metronome/gluon-samples-master/HelloFX/target/gluonfx/aarch64-android/gvm/android_project/gradlew -p /home/phil/Projects/metronome/gluon-samples-master/HelloFX/target/gluonfx/aarch64-android/gvm/android_project installDebug
[Sat Sep 18 19:22:41 PDT 2021][FINE] Start process install-task...

也许有些步骤我省略了,而这些步骤"太明显了"。它们没有包含在文档中?例如,gluonfx:install命令中包含的参数或属性可以在pom.xml中设置。文件吗?

指令中前面的步骤已成功执行:

../gluon-samples-master/HelloFX$ mvn gluonfx:run

程序运行,窗口和图形显示以下消息:

你好,JavaFX 16,运行在Java 15.0.2.

../gluon-samples-master/HelloFX$ mvn -Pandroid gluonfx:build

程序到达BUILD SUCCESS点。控制台上的消息如下:

[Sat Sep 18 18:58:06 PDT 2021][INFO] [SUB] #打印构建工件到:/home/phils/projects/metronome/gluon-samples-master/HelloFX/target/gluonfx/x86_64-linux/gvm/HelloFX/HelloFX . HelloFX .build_artifacts.txt

检查该目录、该文件和其他文件是否存在。但是我没有看到任何关于运行此构建或如何以其他方式验证构建的说明。


我还尝试运行命令mvn -Pandroid gluonfx:nativerun,结果不成功:

phil@UbuntuDesktop:~/Projects/metronome/gluon-samples-master/HelloFX$ mvn -Pandroid gluonfx:nativerun
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< com.gluonhq.samples:hellofx >---------------------
[INFO] Building HelloFX 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- gluonfx-maven-plugin:1.0.5:nativerun (default-cli) @ hellofx ---
[Sat Sep 18 20:09:35 PDT 2021][INFO] ==================== RUN TASK ====================
[Sat Sep 18 20:09:37 PDT 2021][SEVERE] Process run failed with result: 252
Check the log files under /home/phil/Projects/metronome/gluon-samples-master/HelloFX/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Sat Sep 18 20:09:37 PDT 2021][INFO] Logging process [run] to file: /home/phil/Projects/metronome/gluon-samples-master/HelloFX/target/gluonfx/log/process-run-1632020977612.log
java.io.IOException: Application starting failed!
at com.gluonhq.substrate.target.AndroidTargetConfiguration.runUntilEnd(AndroidTargetConfiguration.java:213)
at com.gluonhq.substrate.SubstrateDispatcher.nativeRun(SubstrateDispatcher.java:492)
at com.gluonhq.NativeRunMojo.execute(NativeRunMojo.java:45)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.006 s
[INFO] Finished at: 2021-09-18T20:09:37-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.5:nativerun (default-cli) on project hellofx: Error: Application starting failed!

引用的日志内容如下:

Sat Sep 18 20:09:35 PDT 2021][INFO] ==================== RUN TASK ====================
[Sat Sep 18 20:09:35 PDT 2021][FINE] PB Command for clearLog: /home/phil/Android/Sdk/platform-tools/adb logcat -c
[Sat Sep 18 20:09:35 PDT 2021][FINE] Start process clearLog...
[Sat Sep 18 20:09:35 PDT 2021][FINE] PB Command for run: /home/phil/Android/Sdk/platform-tools/adb shell monkey -p com.gluonhq.samples.hellofx 1
[Sat Sep 18 20:09:35 PDT 2021][FINE] Start process run...
[Sat Sep 18 20:09:36 PDT 2021][FINE] Result for clearLog: 0
[Sat Sep 18 20:09:36 PDT 2021][FINE] PB Command for log: /home/phil/Android/Sdk/platform-tools/adb logcat -v brief -v color GraalCompiled:V GraalActivity:V GraalGluon:V GluonAttach:V AndroidRuntime:E ActivityManager:W *:S
[Sat Sep 18 20:09:36 PDT 2021][FINE] Start process log...
[Sat Sep 18 20:09:37 PDT 2021][FINE] [SUB] ** No activities found to run, monkey aborted.
[Sat Sep 18 20:09:37 PDT 2021][FINE] Result for run: 252
[Sat Sep 18 20:09:37 PDT 2021][SEVERE] Process run failed with result: 252
Check the log files under /home/phil/Projects/metronome/gluon-samples-master/HelloFX/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Sat Sep 18 20:09:37 PDT 2021][INFO] Logging process [run] to file: /home/phil/Projects/metronome/gluon-samples-master/HelloFX/target/gluonfx/log/process-run-1632020977612.log 

让我更加犹豫的是,部分文档似乎已经过时了,我不得不怀疑自己是否做出了正确的调整。例如,文档中提到了"必需的包"。列表包括:ndk-bundle,但我没能找到任何与这个确切的名字。但是我已经通过我的AndroidStudio SDK管理器安装了NDK工具。Android工具选择也没有列出extras;android:m2repositoryextras;google:m2repository所需的软件包。

@ jospereda在评论中给出的答案对我来说似乎是我们可以发布来解决这个特殊问题的答案。他写道,为了在设备上运行应用程序,必须首先将应用程序打包。

因此,如果我理解这一点,如果它还没有被纠正,那么https://docs.gluonhq.com/#platforms_android_development_run节中提到的步骤实际上应该在打包之后,这在https://docs.gluonhq.com/#platforms_android_distribution_build节中讨论。

相关内容

  • 没有找到相关文章

最新更新