Does compileOnly work with Android Native Module?

Viewed 26

I need a help for android native module. Does compileOnly dependency works in Native module.

Let's say I have two native SDKs com.google.firebase:firebase-messaging and com.google.firebase:firebase-inappmessaging-display and one react native plugin firebase-react-native

In 1 plugin only i want to expose public APIs for both native SDKs but I want to add it as optional dependency(compileOnly) so If few Apps don't want to use com.google.firebase:firebase-messaging then they can omit it in App's gradle file.

In Android world it works easily. But in RN when i add one of them as comipleOnly then it throws ClassNotFoundException during runtime.

How do I achieve optional SDK support for Apps so that extra SDK size does not introduce without creating 2 seprate RN plugins?

Thanks

0 Answers
Related