. How can I make a different composable with the same name for each flavor?
d
Dominaezzz
03/28/2021, 7:30 PM
Why do you want the same name? I guess you could use a local.
n
Neal Sanche
03/28/2021, 7:43 PM
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
03/28/2021, 7:56 PM
@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.
Se7eN
03/28/2021, 7:58 PM
@Neal Sanche I tried that but it crashed:
Copy code
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)
n
Neal Sanche
03/28/2021, 8:02 PM
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?