JavaFxPorts on iOS with Gluon

2019-09-10 06:43发布

问题:

i am using a MacBook Pro with OS X El Capitan Version 10.11.3. I try to start a simple "Hello World" Project from Gluon/javaFXports with the iOS Simulator.

If i simply run the project it works on my desktop but every time i run it with "launchIPhoneSimulator" this happens:

14:52:46: Executing external task 'launchIPhoneSimulator'...
:compileJava UP-TO-DATE
:compileRetrolambdaMain UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:createDefaultIOSLauncher UP-TO-DATE
:compileIosJava UP-TO-DATE
:processIosResources UP-TO-DATE
:iosClasses UP-TO-DATE
:launchIPhoneSimulator FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launchIPhoneSimulator'.
> Unable to find a matching device [arch=x86, family=iPhone, name=null, sdk=null]

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.986 secs
Unable to find a matching device [arch=x86, family=iPhone, name=null, sdk=null]
14:52:49: External task execution finished 'launchIPhoneSimulator'.

I am a developer for Apple, but i just got the free account maybe thats the problem?

I have no other idea. Can you help me please?

回答1:

Check that you have XCode installed and updated. You should open it at least once and accept the license. Also you can check XCode -> Window -> Devices for the list of simulators.

This is what I see when I run ./gradlew --info launchIPhoneSimulator:

ios simulator os ios
ios simulator target org.robovm.compiler.target.ios.IOSTarget@3c833d1a
ios simulator arch x86
ios simulator device type DeviceType [deviceName=com.apple.CoreSimulator.SimDeviceType.iPhone-6, 
    sdk=SDK 
    [displayName=Simulator - iOS 9.2, 
    minimalDisplayName=Simulator - 9.2, 
    canonicalName=iphonesimulator9.2, 
    version=9.2, 
    root=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk, 

    major=9, minor=2, revision=0, build=13C75, platformBuild=13C75, platformVersion=9.2, platformName=iphonesimulator], 
    archs=[x86_64, x86]]

According to this, you can try to find out which devices and SDKs you have:

To get a list of possible device names and matching sdk versions, you can run the command ios-sim showdevicetypes. As well, you can run iso-sim showsdks to find out about the supported sdk versions.

the ios-sim command can be found in your local maven repository (which by default is located in your user home directory .m2/repository) under org/robovm/robovm-dist/ROBOVM_VERSION/unpacked/robovm-ROBOVM_VERSION/bin (replace ROBOVM_VERSION with the version used by the jfxmobile plugin).

You should use also the latest version of the plugin (check your build.gradle file):

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.0.7'
    }
}

This version makes use of the RoboVM 1.8.0.