简体   繁体   中英

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). 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

` Execution failed for task ':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 `

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

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 . This is why other plugins like storage work, without being added explicitly to 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:

    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.

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.

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:

    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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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