ext defines extensions only for the project in which it was called. In your case, libraries.my_lib is defined in project.gradle (I think it is build.gradle in the project directory) and thus is not available in another build file ( app.gradle , which I think is build.gradle in app again )) if project not the parent of the app . Projects for children have access to parent properties, and this is the only way to share ext : projects must be connected to each other.
BTW, you can define the properties in the gradle.properties file. There can be many, one for each project in your assembly. Placing one gradle.properties in the root of your assembly, you apply its contents to the root of your project tree, thereby making properties available worldwide (the same applies to the ext block of the root object, as follows from the previous paragraph).
source share