I'm trying to build a build tool for building Android App Bundle. In the stage of using aapt2 link to link all modules together, I got a message saying "can't include static library when not building a static lib." The context is that it is creating the resource-apk.ap_ for one of the feature module of App Bundle and it is linking against the resource-apk.ap_ of the base module. In other words, the input argument for -o is the resource-apk.ap_ for a feature module and one of the input arguments for -I is the resource-apk.ap_ for the base module.
Based on the error message, I think it is regarding the resource-apk.ap_ of the base module as a static library and the resource-apk.ap_ of the feature module as a non-static lib. I then tried to include the parameter --static-lib as an argument, I got the message that "only one of --shared-lib, --static-lib, or --proto_format can be defined." Since I'm building an App Bundle, I need the output of resources table to be in proto format.
I tried to inspect how does Gradle handle this in its code, but I didn't find the exact code of implementing aapt2link.
Could you please point out how could I find examples of dealing with this issue or what would be a possible solution?
Thank you in advance!