简体   繁体   English

无法将Gluon Mobile编译到iOS

[英]Can't compile Gluon Mobile to iOS

Recently, I have been customize gluon charm down plugin on Orientation as the question here , It is working when I testing it with new project (On MacOS). 最近,我在Orientation上自定义了gluon charm down插件, 这里的问题是,当我在新项目中测试它时(在MacOS上),它正在工作。 But when I integrate it into existing project (Original develop on Window Environment), It error when It try ./gradlew --info createIpa , It display the following error 但是,当我将其集成到现有项目(在Window Environment上进行原始开发)时,尝试./gradlew --info createIpa时,它将出错,并显示以下错误

` Execution failed for task ':CashmagIDApp:createIpa'. `任务':CashmagIDApp:createIpa'的执行失败。

java.io.IOException: File is not an archive file: /Users/sovandara/.gradle/caches/modules-2/files-2.1/com.android.support/support-v4/26.1.0/444114b772e5eee3e66f9236ace4acc1964a33b8/support-v4-26.1.0.aar ` java.io.IOException:文件不是归档文件:/Users/sovandara/.gradle/caches/modules-2/files-2.1/com.android.support/support-v4/26.1.0/444114b772e5eee3e66f9236ace4acc1964a33b8/support-v4 -26.1.0.aar`

I can't find any information related to this problem. 我找不到与此问题有关的任何信息。 Please any one help me or give me the clue to find the root cause of the problem. 请任何人帮助我或提供线索以找到问题的根本原因。

Edited 编辑

build.gradle 的build.gradle

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

apply plugin: 'org.javafxports.jfxmobile'
apply from: 'ios-build.gradle'

task xcodebuild {
    doLast {
        xcodebuildIOS("$project.buildDir","$project.projectDir", "CMOrientation")
    }
}

task installNativeLib (type:Copy, dependsOn: xcodebuild) {
    from("$project.buildDir/native")
    into("src/ios/jniLibs")
    include("*.a")
}

repositories {
    jcenter()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
}


mainClassName = 'fr.cashmag.cashmagid.CashmagIdMain'
ext.GLUON_VERSION="5.0.2"
ext.CHARM_DOWN="3.8.6"

dependencies {
    //gluon Version
    compile "com.gluonhq:charm:$GLUON_VERSION"
    //Gluon Charm-Down Version
    compile "com.gluonhq:charm-down-plugin-device:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-browser:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display-desktop:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display-android:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display-ios:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-orientation:$CHARM_DOWN"
    //Zxing Library for Generate Barcode/QRCODE
    compile 'com.google.zxing:core:3.3.3'
}

jfxmobile {
    downConfig {
        version = '3.8.6'
        // Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
        plugins 'display', 'lifecycle', 'statusbar', 'storage','device','browser','orientation'
    }
    android {
        manifest = 'src/android/AndroidManifest.xml'
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
        forceLinkClasses = [
                'fr.cashmag.cashmagid.**.*',
                'com.gluonhq.**.*',
                'javax.annotations.**.*',
                'javax.inject.**.*',
                'javax.json.**.*',
                'org.glassfish.json.**.*'
        ]
    }
}

In the posted build, you have: 在发布的版本中,您具有:

dependencies {
    ...
    //Gluon Charm-Down Version
    compile "com.gluonhq:charm-down-plugin-device:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-browser:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display-desktop:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display-android:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display-ios:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-orientation:$CHARM_DOWN"

}

And then you also have: 然后您还有:

jfxmobile {
    downConfig {
        version = '3.8.6'
        plugins 'display', 'lifecycle', 'statusbar', 'storage','device','browser','orientation'
    }

This means you are adding twice the plugins device , browser and display , as the jxmobile plugin will manage that for you via downConfig . 这意味着您要添加两次插件devicebrowserdisplay ,因为jxmobile插件将通过downConfig为您管理插件。 This is why other plugins like storage work, without being added explicitly to dependencies . 这就是为什么其他插件(例如storage可以在未显式添加到dependencies情况下工作的原因。

Anyway, this shouldn't be a problem at all. 无论如何,这根本不是问题。

However, the issue (having an Android dependency when running an iOS task) comes from the display dependencies: 但是,问题(运行iOS任务时具有Android依赖项)来自display依赖项:

    compile "com.gluonhq:charm-down-plugin-display-desktop:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display-android:$CHARM_DOWN"
    compile "com.gluonhq:charm-down-plugin-display-ios:$CHARM_DOWN"

As you can see, you are adding the platform implementations of the display service as compile dependencies, which means these will be available for all the platforms: Android dependencies (Android SDK, support.aar, ...) will be used on desktop and iOS, which obviously won't work. 如您所见,您将display服务的平台实现添加为compile依赖项,这意味着这些将可用于所有平台:Android依赖项(Android SDK,support.aar,...)将在桌面上使用, iOS,显然不起作用。

As mentioned before, you don't really need to include them at all, so removing all the Charm Down references from dependencies {} will solve your issue. 如前所述,您实际上根本不需要包含它们,因此从dependencies {}删除所有Charm Down引用将解决您的问题。

But if you still need to include them, like you will include the dependencies from a custom service not in Charm Down, you have to use the platform: 但是,如果您仍然需要包括它们,例如您将包括Charm Down中未包含的自定义服务的依赖项,则必须使用平台:

    desktopCompile "com.gluonhq:charm-down-plugin-display-desktop:$CHARM_DOWN"
    androidCompile "com.gluonhq:charm-down-plugin-display-android:$CHARM_DOWN"
    iosCompile "com.gluonhq:charm-down-plugin-display-ios:$CHARM_DOWN"

Now, each of these platform dependencies will be available only for the designed platform. 现在,这些平台依赖项中的每一个都仅对设计的平台可用。

In case you are interested, the jxmobile plugin defines androidCompile and others here . 如果您有兴趣, jxmobile插件在此处定义了androidCompile和其他插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM