s

    Se7eN

    1 year ago
    I have two product flavors,
    free
    and
    pro
    . How can I make a different composable with the same name for each flavor?
    Dominaezzz

    Dominaezzz

    1 year ago
    Why do you want the same name? I guess you could use a local.
    Neal Sanche

    Neal Sanche

    1 year ago
    Guessing you could simply make the same composable function in your two different product flavor directories.
    app/src/free/java
    and
    app/src/pro/java
    something like in this image:
    s

    Se7eN

    1 year ago
    @Dominaezzz I need to show an ad in
    free
    but not in
    pro
    . The ad libraries are not present in
    pro
    so I can't have the same file for both.
    @Neal Sanche I tried that but it crashed:
    java.lang.NoSuchMethodError: No static method CustomBackHandler(Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V in class Lcom/myapp/ui/CustomBackHandlerKt; or its super classes (declaration of 'com.myapp.ui.CustomBackHandlerKt' appears in /data/app/~~vsWTw2NQ7h9zOznCX9tfSg==/com.myapp-AUa0BZIiTevSu2bFJpYcrw==/base.apk!classes8.dex)
    Neal Sanche

    Neal Sanche

    1 year ago
    I tried just a simple case of setting up the Greeting composable in the two different source sets. That worked for me. Not sure why CustomBackHandler is involved in your crash. Perhaps Free and Pro trying to reference code in Main?
    s

    Se7eN

    1 year ago
    Ah I got it. I had the same name as
    CustomBackHandler
    for my
    BaseBackHandler
    file in main. Thanks for the help!