I'm trying to add share button implementation to my Gluon Mobile application and I have followed the GoNative application on their website. Following it step by step, I get a file structure that is different than what is specified. In addition, the Share Service is not found so any of the code in the "ifPresent" lambda doesn't work:
What it looks like
What it is supposed to look like
You can see that the package itself is not getting created (com.gluonhq.charm.down.plugins.ios) when I run the Gluon Mobile Task -> Install -> installNativeLib gradle task.
The files I created to form the plugin are almost identical to those in the GoNative application here. In fact the only difference between them is the word log is changed to share wherever present.
I also even attempted to create the GoNative application identically from the link provided above and the same issue happens. Java folder gets created in the ios package with nothing in it. The plugin cannot be found as a Service (ifPresent returns false).
UPDATE
Given @jns recommendation in the comments, I have put the classes in the correct locations and I get the following error when trying to launch to the iPhone simulator:
Execution failed for task ':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
is not found because it's in the wrong package.
Services.get(ShareService.class)
expects ShareService
to be in the package com.gluonhq.charm.down.plugins
in your main sources
.
The platform specific implementations (AndroidShareService / IosShareService) need to be placed in the corresponding platform sources, e.g. src/ios/java/com.gluonhq.charm.down.plugins.ios
.
See this answer for more information