I have been struggling for a couple of days about this plugin I mentioned in the title a little bit. Let me explain further.
So, I need a Flutter plugin with some very specific native code in it. I have thee different jars and I need to implement them on a condition because I don't want all of them to get inside my output file. I was able to achieve this, I declared a variable on my gradle.properties of my Flutter app and I get it from my Flutter plugin's build.gradle and added some if statements in dependencies block according to that. I created some packages inside my main/src/com/packageId like /firstPart, /secondPart and /thirdPart. They all use a single different jar and contains only specific different functions.
However, I have another problem. Let's say my jar file's names are jar1, jar2, jar3 and when I only imported jar1, the other code that uses jar2 and jar3 throws errors while trying to build. (Because files in the /secondPart and /thirdPart can't find the required imports coming from jar2 and jar3) So, I need a way to fix this problem. I want something like when I add this Flutter plugin to my Flutter app, it should use only the required jar and required package.
What I have tried:
I tried adding some BuildTypes inside my Plugin's android build.gradle and excluding a part of the app like:
buildTypes {
firstBuildType {}
}
sourceSets {
firstBuildType{
java.exclude('src/secondPart')
java.exclude('src/thirdPart')
}
}
But I can't set the specific build type from outside the plugin. And exclude didn't work anyways.
How can I achieve a plugin like this?
Sorry if I write the problem a little bit confusing. English is not my mother language but if you have questions, I would hapilly try to explain better. Thank you in advance.