Copy Gradle dependency res to another Gradle dependency

(Raymond de la Croix) #1

I’m currently developing a few plugin for Android, in Android studio, and have encountered an issue with resources not being found in the end project which implements all the plugins. To deploy a plugin I use gradlew install which generates a .aar, this .aar contains the .jar and a res folder containing the resource files form that project.

Overview of the problem:

Plugin A uses the google dependency.

Plugin A now has an external library added to the project and can access the cardview res folder.

While compiling Plugin B it uses a resource from Plugin A, which is an instance of the cardview.

This cardview uses a resource file from the res folder in Plugin A.

Plugin B now adds Plugin A as dependency.

Plugin B now has the res folder from Plugin A but still misses resource items from the res folder from the cardview dependency.

The error thrown at this point is:

Error:(8) No resource identifier found for attribute 'cardCornerRadius' in package...

This is because Plugin B uses the cardview as so:



The missing card_view:cardCornerRadius isn’t found in my project, because it is never copied over from Plugin A to Plugin B.

My question is as follows:

Is there a way to have my Plugin B understand what card_view:cardCornerRadius is without adding the dependency to Plugin B, but instead copy it over from Plugin A?