Giter Site home page Giter Site logo

Comments (9)

dragitpro avatar dragitpro commented on May 30, 2024 1

Thanks ... Solution then : if someone find this issueto not waste a day like me val json = Res.readBytes(uri).decodeToString()

from compose-multiplatform.

terrakok avatar terrakok commented on May 30, 2024

Did you try any dev versions before the update? There may be broken caches. Try to delete all builds dirs in the project and build it again

from compose-multiplatform.

dragitpro avatar dragitpro commented on May 30, 2024

Thanks for your answer. I hadn't tried the dev version before the update. I deleted the build folders in both the root project and the composeApp folder, invalidated the caches (with all three options checked), and I'm still facing the problem. The Android build is also impacted:

org.jetbrains.compose.resources.MissingResourceException: Missing resource with path: files/loader_player.json
at org.jetbrains.compose.resources.ResourceReader_androidKt$getPlatformResourceReader$1.getResourceAsStream(ResourceReader.android.kt:42)
at org.jetbrains.compose.resources.ResourceReader_androidKt$getPlatformResourceReader$1.read(ResourceReader.android.kt:8)
at org.jetbrains.compose.resources.ResourceReaderKt.readResourceBytes(ResourceReader.kt:15)

I also tried adding the following in case it would help: (not sure if need and how to use)

compose.resources {
    publicResClass = true
    generateResClass = auto
}

but it didn’t solve the problem.

from compose-multiplatform.

terrakok avatar terrakok commented on May 30, 2024

I need a reproducer of the issue. Could you share your project?

from compose-multiplatform.

dragitpro avatar dragitpro commented on May 30, 2024

Unfortunately, I can't share the project. However, I just tried to reproduce the issue on a minimal project and it works fine there. If you have any ideas about what could be causing this error, such as another cache folder to delete, please let me know. Otherwise, I will continue to investigate on my side

from compose-multiplatform.

terrakok avatar terrakok commented on May 30, 2024

Maybe you can show your build log which is a reason of the app crash?

from compose-multiplatform.

dragitpro avatar dragitpro commented on May 30, 2024

I find how to trigger the error : its when seting compose-plugin to "1.6.10-beta01" on https://kmp.jetbrains.com/ project using this code :

@OptIn(InternalResourceApi::class)
@Composable
fun DisplayJson(){
    var json by remember { mutableStateOf<String?>(null) }
    Text(json ?: "Loading...")
    LaunchedEffect(Unit) {
        val uri = "files/example.json"
         json = readResourceBytes(uri).decodeToString()
    }
}

So i'm not sure if it was me doing wrong using "1.6.10-beta01" as plugin-version , specialy after reading realse notes

Gradle Plugin org.jetbrains.compose, version 1.6.10-beta01. Based on Jetpack Compose libraries:

from compose-multiplatform.

terrakok avatar terrakok commented on May 30, 2024

The code snippet uses java resources instead of compose multiplatform resources.

from compose-multiplatform.

terrakok avatar terrakok commented on May 30, 2024

It won't work with a composeResources directory

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.