why kotlin multiplatform don't execute and export iOS framework?












0















I started develop kotlin multiplatform and I developed a simple lib for test. I can exported .jar file for android but I can't export .framework file for iOS.
I reviewed other project but I didn't find my issue.



my Gradle script for lib is:



apply plugin: 'kotlin-multiplatform'

kotlin {
targets {
final def iOSTarget =
System.getenv('SDK_NAME')?.startsWith("iphoneos")
? presets.iosArm64 : presets.iosX64

fromPreset(iOSTarget, 'iOS') {
compilations.main.outputKinds('FRAMEWORK')
}

fromPreset(presets.jvm, 'android')
}

sourceSets {
core.dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib-common'
}

android.dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib'
}
}









share|improve this question



























    0















    I started develop kotlin multiplatform and I developed a simple lib for test. I can exported .jar file for android but I can't export .framework file for iOS.
    I reviewed other project but I didn't find my issue.



    my Gradle script for lib is:



    apply plugin: 'kotlin-multiplatform'

    kotlin {
    targets {
    final def iOSTarget =
    System.getenv('SDK_NAME')?.startsWith("iphoneos")
    ? presets.iosArm64 : presets.iosX64

    fromPreset(iOSTarget, 'iOS') {
    compilations.main.outputKinds('FRAMEWORK')
    }

    fromPreset(presets.jvm, 'android')
    }

    sourceSets {
    core.dependencies {
    api 'org.jetbrains.kotlin:kotlin-stdlib-common'
    }

    android.dependencies {
    api 'org.jetbrains.kotlin:kotlin-stdlib'
    }
    }









    share|improve this question

























      0












      0








      0








      I started develop kotlin multiplatform and I developed a simple lib for test. I can exported .jar file for android but I can't export .framework file for iOS.
      I reviewed other project but I didn't find my issue.



      my Gradle script for lib is:



      apply plugin: 'kotlin-multiplatform'

      kotlin {
      targets {
      final def iOSTarget =
      System.getenv('SDK_NAME')?.startsWith("iphoneos")
      ? presets.iosArm64 : presets.iosX64

      fromPreset(iOSTarget, 'iOS') {
      compilations.main.outputKinds('FRAMEWORK')
      }

      fromPreset(presets.jvm, 'android')
      }

      sourceSets {
      core.dependencies {
      api 'org.jetbrains.kotlin:kotlin-stdlib-common'
      }

      android.dependencies {
      api 'org.jetbrains.kotlin:kotlin-stdlib'
      }
      }









      share|improve this question














      I started develop kotlin multiplatform and I developed a simple lib for test. I can exported .jar file for android but I can't export .framework file for iOS.
      I reviewed other project but I didn't find my issue.



      my Gradle script for lib is:



      apply plugin: 'kotlin-multiplatform'

      kotlin {
      targets {
      final def iOSTarget =
      System.getenv('SDK_NAME')?.startsWith("iphoneos")
      ? presets.iosArm64 : presets.iosX64

      fromPreset(iOSTarget, 'iOS') {
      compilations.main.outputKinds('FRAMEWORK')
      }

      fromPreset(presets.jvm, 'android')
      }

      sourceSets {
      core.dependencies {
      api 'org.jetbrains.kotlin:kotlin-stdlib-common'
      }

      android.dependencies {
      api 'org.jetbrains.kotlin:kotlin-stdlib'
      }
      }






      kotlin kotlin-native kotlin-multiplatform






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 31 '18 at 8:29









      Alireza TarazaniAlireza Tarazani

      1368




      1368
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Have you added the task to build the actual framework? If not, try adding this code at the end of your build.gradle file:



          task packForXCode(type: Sync) {
          final File frameworkDir = new File(buildDir, "xcode-frameworks")
          final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'

          inputs.property "mode", mode
          dependsOn kotlin.targets.iOS.compilations.main.linkTaskName("FRAMEWORK", mode)

          from { kotlin.targets.iOS.compilations.main.getBinary("FRAMEWORK", mode).parentFile }
          into frameworkDir

          doLast {
          new File(frameworkDir, 'gradlew').with {
          text = "#!/bin/bashnexport 'JAVA_HOME=${System.getProperty("java.home")}'ncd '${rootProject.rootDir}'n./gradlew $@n"
          setExecutable(true)
          }
          }
          }

          tasks.build.dependsOn packForXCode


          The iOS framework will be available on the build/xcode-frameworks directory of your library.



          You'll have to configure also your Xcode project to use the framework. For further details you can read Setting up Framework Dependency in Xcode.






          share|improve this answer
























          • Thanks I added it but not work.

            – Alireza Tarazani
            Jan 2 at 18:53











          • @AlirezaTarazani what's the error message now?

            – Diego Palomar
            Jan 3 at 19:22













          • no error message for this. just don't any exports for iOS.

            – Alireza Tarazani
            Jan 4 at 8:08











          • @AlirezaTarazani. No error message? I doubt it but make sure the task is actually executed.

            – Diego Palomar
            Jan 4 at 11:18













          • After adding packForXCode, are you running ./gradlew :common:packForXCode (assuming your build.gradle is in a directory called common). I'm able to get it working using the code posted here and running this command.

            – Mark
            Jan 17 at 14:34



















          0














          What do you mean by "exporting a framework"? Are you going to use it from another Gradle project or from XCode or from something else?



          P.S. Sorry for asking in answers: just have no enough reputation to leave a comment. So I think it would be more convenient to discuss you problem in issues at GitHub.






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53985241%2fwhy-kotlin-multiplatform-dont-execute-and-export-ios-framework%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Have you added the task to build the actual framework? If not, try adding this code at the end of your build.gradle file:



            task packForXCode(type: Sync) {
            final File frameworkDir = new File(buildDir, "xcode-frameworks")
            final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'

            inputs.property "mode", mode
            dependsOn kotlin.targets.iOS.compilations.main.linkTaskName("FRAMEWORK", mode)

            from { kotlin.targets.iOS.compilations.main.getBinary("FRAMEWORK", mode).parentFile }
            into frameworkDir

            doLast {
            new File(frameworkDir, 'gradlew').with {
            text = "#!/bin/bashnexport 'JAVA_HOME=${System.getProperty("java.home")}'ncd '${rootProject.rootDir}'n./gradlew $@n"
            setExecutable(true)
            }
            }
            }

            tasks.build.dependsOn packForXCode


            The iOS framework will be available on the build/xcode-frameworks directory of your library.



            You'll have to configure also your Xcode project to use the framework. For further details you can read Setting up Framework Dependency in Xcode.






            share|improve this answer
























            • Thanks I added it but not work.

              – Alireza Tarazani
              Jan 2 at 18:53











            • @AlirezaTarazani what's the error message now?

              – Diego Palomar
              Jan 3 at 19:22













            • no error message for this. just don't any exports for iOS.

              – Alireza Tarazani
              Jan 4 at 8:08











            • @AlirezaTarazani. No error message? I doubt it but make sure the task is actually executed.

              – Diego Palomar
              Jan 4 at 11:18













            • After adding packForXCode, are you running ./gradlew :common:packForXCode (assuming your build.gradle is in a directory called common). I'm able to get it working using the code posted here and running this command.

              – Mark
              Jan 17 at 14:34
















            0














            Have you added the task to build the actual framework? If not, try adding this code at the end of your build.gradle file:



            task packForXCode(type: Sync) {
            final File frameworkDir = new File(buildDir, "xcode-frameworks")
            final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'

            inputs.property "mode", mode
            dependsOn kotlin.targets.iOS.compilations.main.linkTaskName("FRAMEWORK", mode)

            from { kotlin.targets.iOS.compilations.main.getBinary("FRAMEWORK", mode).parentFile }
            into frameworkDir

            doLast {
            new File(frameworkDir, 'gradlew').with {
            text = "#!/bin/bashnexport 'JAVA_HOME=${System.getProperty("java.home")}'ncd '${rootProject.rootDir}'n./gradlew $@n"
            setExecutable(true)
            }
            }
            }

            tasks.build.dependsOn packForXCode


            The iOS framework will be available on the build/xcode-frameworks directory of your library.



            You'll have to configure also your Xcode project to use the framework. For further details you can read Setting up Framework Dependency in Xcode.






            share|improve this answer
























            • Thanks I added it but not work.

              – Alireza Tarazani
              Jan 2 at 18:53











            • @AlirezaTarazani what's the error message now?

              – Diego Palomar
              Jan 3 at 19:22













            • no error message for this. just don't any exports for iOS.

              – Alireza Tarazani
              Jan 4 at 8:08











            • @AlirezaTarazani. No error message? I doubt it but make sure the task is actually executed.

              – Diego Palomar
              Jan 4 at 11:18













            • After adding packForXCode, are you running ./gradlew :common:packForXCode (assuming your build.gradle is in a directory called common). I'm able to get it working using the code posted here and running this command.

              – Mark
              Jan 17 at 14:34














            0












            0








            0







            Have you added the task to build the actual framework? If not, try adding this code at the end of your build.gradle file:



            task packForXCode(type: Sync) {
            final File frameworkDir = new File(buildDir, "xcode-frameworks")
            final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'

            inputs.property "mode", mode
            dependsOn kotlin.targets.iOS.compilations.main.linkTaskName("FRAMEWORK", mode)

            from { kotlin.targets.iOS.compilations.main.getBinary("FRAMEWORK", mode).parentFile }
            into frameworkDir

            doLast {
            new File(frameworkDir, 'gradlew').with {
            text = "#!/bin/bashnexport 'JAVA_HOME=${System.getProperty("java.home")}'ncd '${rootProject.rootDir}'n./gradlew $@n"
            setExecutable(true)
            }
            }
            }

            tasks.build.dependsOn packForXCode


            The iOS framework will be available on the build/xcode-frameworks directory of your library.



            You'll have to configure also your Xcode project to use the framework. For further details you can read Setting up Framework Dependency in Xcode.






            share|improve this answer













            Have you added the task to build the actual framework? If not, try adding this code at the end of your build.gradle file:



            task packForXCode(type: Sync) {
            final File frameworkDir = new File(buildDir, "xcode-frameworks")
            final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'

            inputs.property "mode", mode
            dependsOn kotlin.targets.iOS.compilations.main.linkTaskName("FRAMEWORK", mode)

            from { kotlin.targets.iOS.compilations.main.getBinary("FRAMEWORK", mode).parentFile }
            into frameworkDir

            doLast {
            new File(frameworkDir, 'gradlew').with {
            text = "#!/bin/bashnexport 'JAVA_HOME=${System.getProperty("java.home")}'ncd '${rootProject.rootDir}'n./gradlew $@n"
            setExecutable(true)
            }
            }
            }

            tasks.build.dependsOn packForXCode


            The iOS framework will be available on the build/xcode-frameworks directory of your library.



            You'll have to configure also your Xcode project to use the framework. For further details you can read Setting up Framework Dependency in Xcode.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 2 at 12:11









            Diego PalomarDiego Palomar

            5,95912232




            5,95912232













            • Thanks I added it but not work.

              – Alireza Tarazani
              Jan 2 at 18:53











            • @AlirezaTarazani what's the error message now?

              – Diego Palomar
              Jan 3 at 19:22













            • no error message for this. just don't any exports for iOS.

              – Alireza Tarazani
              Jan 4 at 8:08











            • @AlirezaTarazani. No error message? I doubt it but make sure the task is actually executed.

              – Diego Palomar
              Jan 4 at 11:18













            • After adding packForXCode, are you running ./gradlew :common:packForXCode (assuming your build.gradle is in a directory called common). I'm able to get it working using the code posted here and running this command.

              – Mark
              Jan 17 at 14:34



















            • Thanks I added it but not work.

              – Alireza Tarazani
              Jan 2 at 18:53











            • @AlirezaTarazani what's the error message now?

              – Diego Palomar
              Jan 3 at 19:22













            • no error message for this. just don't any exports for iOS.

              – Alireza Tarazani
              Jan 4 at 8:08











            • @AlirezaTarazani. No error message? I doubt it but make sure the task is actually executed.

              – Diego Palomar
              Jan 4 at 11:18













            • After adding packForXCode, are you running ./gradlew :common:packForXCode (assuming your build.gradle is in a directory called common). I'm able to get it working using the code posted here and running this command.

              – Mark
              Jan 17 at 14:34

















            Thanks I added it but not work.

            – Alireza Tarazani
            Jan 2 at 18:53





            Thanks I added it but not work.

            – Alireza Tarazani
            Jan 2 at 18:53













            @AlirezaTarazani what's the error message now?

            – Diego Palomar
            Jan 3 at 19:22







            @AlirezaTarazani what's the error message now?

            – Diego Palomar
            Jan 3 at 19:22















            no error message for this. just don't any exports for iOS.

            – Alireza Tarazani
            Jan 4 at 8:08





            no error message for this. just don't any exports for iOS.

            – Alireza Tarazani
            Jan 4 at 8:08













            @AlirezaTarazani. No error message? I doubt it but make sure the task is actually executed.

            – Diego Palomar
            Jan 4 at 11:18







            @AlirezaTarazani. No error message? I doubt it but make sure the task is actually executed.

            – Diego Palomar
            Jan 4 at 11:18















            After adding packForXCode, are you running ./gradlew :common:packForXCode (assuming your build.gradle is in a directory called common). I'm able to get it working using the code posted here and running this command.

            – Mark
            Jan 17 at 14:34





            After adding packForXCode, are you running ./gradlew :common:packForXCode (assuming your build.gradle is in a directory called common). I'm able to get it working using the code posted here and running this command.

            – Mark
            Jan 17 at 14:34













            0














            What do you mean by "exporting a framework"? Are you going to use it from another Gradle project or from XCode or from something else?



            P.S. Sorry for asking in answers: just have no enough reputation to leave a comment. So I think it would be more convenient to discuss you problem in issues at GitHub.






            share|improve this answer




























              0














              What do you mean by "exporting a framework"? Are you going to use it from another Gradle project or from XCode or from something else?



              P.S. Sorry for asking in answers: just have no enough reputation to leave a comment. So I think it would be more convenient to discuss you problem in issues at GitHub.






              share|improve this answer


























                0












                0








                0







                What do you mean by "exporting a framework"? Are you going to use it from another Gradle project or from XCode or from something else?



                P.S. Sorry for asking in answers: just have no enough reputation to leave a comment. So I think it would be more convenient to discuss you problem in issues at GitHub.






                share|improve this answer













                What do you mean by "exporting a framework"? Are you going to use it from another Gradle project or from XCode or from something else?



                P.S. Sorry for asking in answers: just have no enough reputation to leave a comment. So I think it would be more convenient to discuss you problem in issues at GitHub.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 3 at 5:49









                Ilya MatveevIlya Matveev

                612




                612






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53985241%2fwhy-kotlin-multiplatform-dont-execute-and-export-ios-framework%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Monofisismo

                    Angular Downloading a file using contenturl with Basic Authentication

                    Olmecas