Thread
#multiplatform
    r

    Rita Curado

    2 years ago
    Hi everyone! Could someone tell me if it is possible to access properties from
    gradle.properties
    in common code? If not, how can I set an environment variable and read it on common code? Thanks in advance
    k

    Kamil Kalisz

    2 years ago
    Hi Rita, Could you share your use case ? As i know gradle.properties are compile time available, and are not included into result binary. I don’t know your use case but probably it would be best for you to generate kotlin class in the common code that will contain configuration values from gradle.properties
    andylamax

    andylamax

    2 years ago
    This is what I am doing at the moment. By using gradle, I export a json file, that is bundle up in android, or, js, or jvm. From there I can read the variables from the json as my environment variables. I have defined expect actual methods for reading json into a Map<String,Any> which can be used in MPP
    r

    Rita Curado

    2 years ago
    Thanks for the answers 🙂 So I should add a new file with the variables I need right?
    Meanwhile I started using an external library called BuildKonfig that let me specify some variables from gradle.properties to be used inside common code
    andylamax

    andylamax

    2 years ago
    a link to BuildKonfig please?
    r

    Rita Curado

    2 years ago