Fat jar problem with Ktor and Kotlin multiplatformAndroid Studio: Add jar as library?Shadow Jar doesn't include dependencies into fat jarInclude sources in fat JARHow to compile different flavors while building a fat jar using GradleAndroid Studio Not Seeing Dependency (but Gradle does!)Ktor: Serialize/Deserialize JSON with List as root in MultiplatformUsing gradle shadow with Kotlin multiplatformAndroid - Kotlin files are present in apk after compilationktor dependencies not resolved in ios module of multiplatform projectKotlin Multiplatform with iOS: “Use of undeclared type 'KotlinCoroutineContext'”

Is it possible to record a short contained sound no longer than 60 milliseconds?

How do I deal with an unproductive colleague in a small company?

What's the output of a record needle playing an out-of-speed record

What does the "remote control" for a QF-4 look like?

Why is 150k or 200k jobs considered good when there's 300k+ births a month?

Replacing matching entries in one column of a file by another column from a different file

Can I make popcorn with any corn?

Is it possible to do 50 km distance without any previous training?

Do I have a twin with permutated remainders?

What's that red-plus icon near a text?

Why can't we play rap on piano?

Did Shadowfax go to Valinor?

What does "Puller Prush Person" mean?

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

What is the word for reserving something for yourself before others do?

Important Resources for Dark Age Civilizations?

Can you really stack all of this on an Opportunity Attack?

Can a Cauchy sequence converge for one metric while not converging for another?

Is it possible to run Internet Explorer on OS X El Capitan?

dbcc cleantable batch size explanation

How does quantile regression compare to logistic regression with the variable split at the quantile?

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

Is it legal for company to use my work email to pretend I still work there?

Why can't I see bouncing of a switch on an oscilloscope?



Fat jar problem with Ktor and Kotlin multiplatform


Android Studio: Add jar as library?Shadow Jar doesn't include dependencies into fat jarInclude sources in fat JARHow to compile different flavors while building a fat jar using GradleAndroid Studio Not Seeing Dependency (but Gradle does!)Ktor: Serialize/Deserialize JSON with List as root in MultiplatformUsing gradle shadow with Kotlin multiplatformAndroid - Kotlin files are present in apk after compilationktor dependencies not resolved in ios module of multiplatform projectKotlin Multiplatform with iOS: “Use of undeclared type 'KotlinCoroutineContext'”






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a kotlin multiplatform project targeting Android and iOS and recently integrated ktor so that the shared library can load web resources. It's working on iOS, but on Android I get this error:



java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/HttpClientJvmKt



I'm guessing my build pipeline is creating a jar that doesn't contain all the dependencies that ktor needs. So I'm trying to make a fat jar using the gradle shadow plugin (com.github.jengelman.gradle.plugins:shadow:2.0.4). Here is my task:



task shadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) 
from kotlin.targets.android.compilations.main.output
def runtimeClasspath = kotlin.targets.android.compilations.main.runtimeDependencyFiles
configurations = [runtimeClasspath]
baseName = 'myproject-android-shadow'
exclude 'META-INF/*'
exclude '*.kotlin_metadata'



The jar jumped up from 300Kb to 8.5Mb.



The result is a new error: More than one file was found with OS independent path 'kotlinx/coroutines/CoroutineExceptionHandler.kotlin_metadata'



You'll notice I've tried excluding files from the shadowJar, but it's not working.










share|improve this question




























    0















    I have a kotlin multiplatform project targeting Android and iOS and recently integrated ktor so that the shared library can load web resources. It's working on iOS, but on Android I get this error:



    java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/HttpClientJvmKt



    I'm guessing my build pipeline is creating a jar that doesn't contain all the dependencies that ktor needs. So I'm trying to make a fat jar using the gradle shadow plugin (com.github.jengelman.gradle.plugins:shadow:2.0.4). Here is my task:



    task shadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) 
    from kotlin.targets.android.compilations.main.output
    def runtimeClasspath = kotlin.targets.android.compilations.main.runtimeDependencyFiles
    configurations = [runtimeClasspath]
    baseName = 'myproject-android-shadow'
    exclude 'META-INF/*'
    exclude '*.kotlin_metadata'



    The jar jumped up from 300Kb to 8.5Mb.



    The result is a new error: More than one file was found with OS independent path 'kotlinx/coroutines/CoroutineExceptionHandler.kotlin_metadata'



    You'll notice I've tried excluding files from the shadowJar, but it's not working.










    share|improve this question
























      0












      0








      0








      I have a kotlin multiplatform project targeting Android and iOS and recently integrated ktor so that the shared library can load web resources. It's working on iOS, but on Android I get this error:



      java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/HttpClientJvmKt



      I'm guessing my build pipeline is creating a jar that doesn't contain all the dependencies that ktor needs. So I'm trying to make a fat jar using the gradle shadow plugin (com.github.jengelman.gradle.plugins:shadow:2.0.4). Here is my task:



      task shadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) 
      from kotlin.targets.android.compilations.main.output
      def runtimeClasspath = kotlin.targets.android.compilations.main.runtimeDependencyFiles
      configurations = [runtimeClasspath]
      baseName = 'myproject-android-shadow'
      exclude 'META-INF/*'
      exclude '*.kotlin_metadata'



      The jar jumped up from 300Kb to 8.5Mb.



      The result is a new error: More than one file was found with OS independent path 'kotlinx/coroutines/CoroutineExceptionHandler.kotlin_metadata'



      You'll notice I've tried excluding files from the shadowJar, but it's not working.










      share|improve this question














      I have a kotlin multiplatform project targeting Android and iOS and recently integrated ktor so that the shared library can load web resources. It's working on iOS, but on Android I get this error:



      java.lang.NoClassDefFoundError: Failed resolution of: Lio/ktor/client/HttpClientJvmKt



      I'm guessing my build pipeline is creating a jar that doesn't contain all the dependencies that ktor needs. So I'm trying to make a fat jar using the gradle shadow plugin (com.github.jengelman.gradle.plugins:shadow:2.0.4). Here is my task:



      task shadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) 
      from kotlin.targets.android.compilations.main.output
      def runtimeClasspath = kotlin.targets.android.compilations.main.runtimeDependencyFiles
      configurations = [runtimeClasspath]
      baseName = 'myproject-android-shadow'
      exclude 'META-INF/*'
      exclude '*.kotlin_metadata'



      The jar jumped up from 300Kb to 8.5Mb.



      The result is a new error: More than one file was found with OS independent path 'kotlinx/coroutines/CoroutineExceptionHandler.kotlin_metadata'



      You'll notice I've tried excluding files from the shadowJar, but it's not working.







      gradle ktor kotlin-multiplatform gradle-shadow-plugin






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 21 at 23:03









      vortekvortek

      385113




      385113






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Although building a fat jar is possible, the easier solution was to include the missing dependencies (ktor and kotlinx) in the app directly. Then I had to add a bunch of exclude 'META-INF ... statements in packagingOptions.






          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%2f55290508%2ffat-jar-problem-with-ktor-and-kotlin-multiplatform%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Although building a fat jar is possible, the easier solution was to include the missing dependencies (ktor and kotlinx) in the app directly. Then I had to add a bunch of exclude 'META-INF ... statements in packagingOptions.






            share|improve this answer



























              0














              Although building a fat jar is possible, the easier solution was to include the missing dependencies (ktor and kotlinx) in the app directly. Then I had to add a bunch of exclude 'META-INF ... statements in packagingOptions.






              share|improve this answer

























                0












                0








                0







                Although building a fat jar is possible, the easier solution was to include the missing dependencies (ktor and kotlinx) in the app directly. Then I had to add a bunch of exclude 'META-INF ... statements in packagingOptions.






                share|improve this answer













                Although building a fat jar is possible, the easier solution was to include the missing dependencies (ktor and kotlinx) in the app directly. Then I had to add a bunch of exclude 'META-INF ... statements in packagingOptions.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 16:49









                vortekvortek

                385113




                385113





























                    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%2f55290508%2ffat-jar-problem-with-ktor-and-kotlin-multiplatform%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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript