Go Native 应用程序无法正常工作 - Gluon Mobile

Go Native App Not Working Correctly - Gluon Mobile

我正在尝试将共享按钮实现添加到我的 Gluon Mobile 应用程序中,并且我已经关注了他们网站上的 GoNative 应用程序。一步一步地,我得到一个与指定的不同的文件结构。此外,找不到共享服务,因此 "ifPresent" lambda 中的任何代码都不起作用:

长什么样子

它应该是什么样子

当我 运行 Gluon Mobile 任务 -> 安装 -> installNativeLib gradle 任务时,你可以看到包本身没有被创建 (com.gluonhq.charm.down.plugins.ios)。

我为构成插件而创建的文件与 GoNative 应用程序中的文件几乎相同 here。事实上,它们之间的唯一区别是日志一词被更改为共享。

我什至还尝试从上面提供的 link 创建相同的 GoNative 应用程序,但同样的问题发生了。 Java 文件夹在 ios 包中创建,其中没有任何内容。找不到作为服务的插件 (ifPresent returns false)。

更新

鉴于@jns 在评论中的建议,我已将 类 放在正确的位置,并且在尝试启动到 iPhone 模拟器时出现以下错误:

任务“:launchiPhoneSimulator”执行失败。

org.apache.commons.exec.ExecuteException: Command '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -o /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/konfamdbranch -arch i386 -Wl,-filelist,/Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/objects0 -L /Users/ashishsharma/.gradle/caches/modules-2/files-2.1/com.mobidevelop.robovm/robovm-dist/2.3.0/5628ca14c9057976088ce11fe045c2e1beea9a0b/unpacked/robovm-2.3.0/lib/vm/ios/x86 -ObjC -exported_symbols_list /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/exported_symbols -Wl,-no_implicit_dylibs -Wl,-dead_strip -fPIC -mios-simulator-version-min=8.0 -Wl,-no_pie -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -lrobovm-bc -force_load /Users/ashishsharma/.gradle/caches/modules-2/files-2.1/com.mobidevelop.robovm/robovm-dist/2.3.0/5628ca14c9057976088ce11fe045c2e1beea9a0b/unpacked/robovm-2.3.0/lib/vm/ios/x86/librobovm-rt.a -lrobovm-debug -lrobovm-core -lgc -lpthread -ldl -lm -lz -liconv -lsqlite3 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework CoreGraphics -framework CoreText -framework ImageIO -framework MobileCoreServices -framework CoreBluetooth -framework CoreLocation -framework CoreMedia -framework CoreMotion -framework AVFoundation -framework AudioToolbox -framework MediaPlayer -framework UserNotifications -framework AVKit -force_load /Users/ashishsharma/.gradle/caches/modules-2/files-2.1/org.javafxports/ios-sdk/8.60.9/e900bcbcc39096ff9a3a409c28efe35d32f57ef5/unpacked/ios-sdk/rt/lib/libglass.a -force_load /Users/ashishsharma/.gradle/caches/modules-2/files-2.1/org.javafxports/ios-sdk/8.60.9/e900bcbcc39096ff9a3a409c28efe35d32f57ef5/unpacked/ios-sdk/rt/lib/libjavafx_font.a -force_load /Users/ashishsharma/.gradle/caches/modules-2/files-2.1/org.javafxports/ios-sdk/8.60.9/e900bcbcc39096ff9a3a409c28efe35d32f57ef5/unpacked/ios-sdk/rt/lib/libjavafx_iio.a -force_load /Users/ashishsharma/.gradle/caches/modules-2/files-2.1/org.javafxports/ios-sdk/8.60.9/e900bcbcc39096ff9a3a409c28efe35d32f57ef5/unpacked/ios-sdk/rt/lib/libjavafx_ios_webnode.a -force_load /Users/ashishsharma/.gradle/caches/modules-2/files-2.1/org.javafxports/ios-sdk/8.60.9/e900bcbcc39096ff9a3a409c28efe35d32f57ef5/unpacked/ios-sdk/rt/lib/libprism_common.a -force_load /Users/ashishsharma/.gradle/caches/modules-2/files-2.1/org.javafxports/ios-sdk/8.60.9/e900bcbcc39096ff9a3a409c28efe35d32f57ef5/unpacked/ios-sdk/rt/lib/libprism_es2.a -l/Users/ashishsharma/NetBeansProjects/konfamdbranch/src/ios/jniLibs/.DS_Store -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/src/ios/jniLibs/libShare.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libBarcodeScan.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libCharm.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libConnectivity.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libDialer.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libDisplay.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libLifecycle.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libLocalNotifications.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libPosition.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libRuntimeArgs.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libStatusBar.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libStorage.a -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks' failed (Exit value: 1)

ShareService 找不到,因为它在错误的包中。

Services.get(ShareService.class) 期望 ShareService 在您的 main sources 中的包 com.gluonhq.charm.down.plugins 中。 平台特定的实现(AndroidShareService / IosShareService)需要放在相应的平台源中,例如src/ios/java/com.gluonhq.charm.down.plugins.ios

查看此了解更多信息