Giter VIP home page Giter VIP logo

Comments (4)

terrakok avatar terrakok commented on July 24, 2024 2

@sereden you forgot about the src dir: move resources/commonMain -> resources/src/commonMain

from compose-multiplatform.

jcaiqueoliveira avatar jcaiqueoliveira commented on July 24, 2024

I'm getting a similar problem but with fonts

Config:

compose-plugin = "1.6.10"
kotlin = "2.0.0"

jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinVersion" }

// res config:

compose.resources {
    publicResClass = true
    packageOfResClass = "sample.resources"
    generateResClass = always
}

Code to expose font:

@Composable
public fun workSans(): FontFamily {
    return FontFamily(Font(Res.font.worksans_default))
}
Caused by: java.lang.IllegalStateException: 
Unable to load font Font(assetManager, path=composeResources/sample.resources/font/worksans-default.ttf, weight=FontWeight(weight=400), style=Normal)
                                                                                                    	at androidx.compose.ui.text.font.FontListFontFamilyTypefaceAdapterKt.firstImmediatelyAvailable(FontListFontFamilyTypefaceAdapter.kt:195)
                                                                                                    	at androidx.compose.ui.text.font.FontListFontFamilyTypefaceAdapterKt.access$firstImmediatelyAvailable(FontListFontFamilyTypefaceAdapter.kt:1)
                                                                                                    	at androidx.compose.ui.text.font.FontListFontFamilyTypefaceAdapter.resolve(FontListFontFamilyTypefaceAdapter.kt:133)
                                                                                                    	at androidx.compose.ui.text.font.FontFamilyResolverImpl$resolve$result$1.invoke(FontFamilyResolver.kt:93)
                                                                                                    	at androidx.compose.ui.text.font.FontFamilyResolverImpl$resolve$result$1.invoke(FontFamilyResolver.kt:92)
                                                                                                    	at androidx.compose.ui.text.font.TypefaceRequestCache.runCached(FontFamilyResolver.kt:192)
                                                                                                    	... 131 more

Testproject.zip

from compose-multiplatform.

Nek-12 avatar Nek-12 commented on July 24, 2024

Guys, do you know is it possible to share resources between composeApp and server? I can't do it because it says my server module should be marked as multiplatform module (because resources module, that I apply to server module` should be also marked as multiplatform) - https://kotlinlang.slack.com/archives/C3PQML5NU/p1716676813612929

How is this related to the issue?

from compose-multiplatform.

YoussefHachicha avatar YoussefHachicha commented on July 24, 2024

same issue here using
kotlin = "2.0.0"
compose = "1.6.20-dev1646"

whenever I try to create a composeResources directory I only get suggested this which is the old impl
Screenshot 2024-05-26 at 11 08 03 AM

from compose-multiplatform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.