我试图在我的Gluon Mobile应用程序中添加共享按钮实现,并且我已经在他们的网站上关注了GoNative应用程序。按照它一步一步地进行,我得到的文件结构与指定的不同。此外,找不到共享服务,所以" ifPresent"中的任何代码都没有找到。 lambda不起作用:
看起来像什么
应该是什么样子
当我运行Gluon Mobile任务时,你可以看到包本身没有被创建(com.gluonhq.charm.down.plugins.ios) - >安装 - > installNativeLib gradle任务。
我创建的用于构成插件的文件几乎与GoNative应用程序here中的文件相同。实际上,它们之间的唯一区别是将日志更改为在任何位置共享。
我甚至还尝试从上面提供的链接创建GoNative应用程序,并且会出现同样的问题。 Java文件夹在ios包中创建,其中没有任何内容。该插件无法作为服务找到(ifPresent返回false)。
更新
鉴于评论中的@jns建议,我已将这些类放在正确的位置,并且在尝试启动到iPhone模拟器时出现以下错误:
任务执行失败&#39 ;: 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/平台/ 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.0 / 5628c a14c9057976088ce11fe045c2e1beea9a0b /解压/ robovm-2.3.0 / lib目录/ VM / IOS / 86 / librobovm-rt.a -lrobovm调试-lrobovm核心-lgc -lpthread -ldl -lm -lz -liconv -lsqlite3 -framework基金会-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 /用户/ ashishsharma / .gradle /高速缓存/模块-2 /文件-2.1 / org.javafxports / IOS-SDK / 8.60.9 / e900bcbcc39096ff9a3a409c28efe35d32f57ef5 /解压/ IOS-SDK / RT / LIB / libjavafx_font.a -force_load /Users/ashishsharma/.gradle/高速缓存/模块-2 /文件-2.1 / org.javafxports / IOS-SDK / 8.60.9 / E9 00bcbcc39096ff9a3a409c28efe35d32f57ef5 / 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 / nati VE / libCharm.a -force_load /Users/ashishsharma/NetBeansProjects/konfamdbranch/build/javafxports/tmp/ios/native/libConnectivity.a -force_load /用户/ ashishsharma /的NetBeansProjects / konfamdbranch /编译/ javafxports的/ tmp / IOS /本地/ 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 /用户/ ashishsharma /的NetBeansProjects / konfamdbranch /建造/ javafxports / TMP / IOS / n的ative / libStorage.a -Xlinker -rpath -Xlinker @ executable_path / Frameworks -Xlinker -rpath -Xlinker @ loader_path / Frameworks'失败(退出值:1)
答案 0 :(得分:2)
ShareService
,因为它位于错误的包中。
Services.get(ShareService.class)
期望ShareService
位于com.gluonhq.charm.down.plugins
的{{1}}个包中。
平台特定实现(AndroidShareService / IosShareService)需要放置在相应的平台源中,例如, main sources
。
有关详细信息,请参阅此answer