admin管理员组

文章数量:1388760

I am using an AAR library in my Android project, and I need to extract the version of this library dynamically inside build.gradle.kts and inject it into BuildConfig.

Approaches tried

Accessing BuildConfig of the AAR Library I tried accessing the BuildConfig file inside the AAR library.

Issue: BuildConfig is generated per module and isn’t available at Gradle build time.

I attempted to extract the library version from configurations.implementation.

Issue: implementation dependencies are marked as canBeResolved=false, meaning they cannot be directly queried.

Running gradle app:dependencies prints all installed dependencies along with their versions.

Issue: While the version is displayed in the console, I couldn't find a way to access it programmatically inside build.gradle.kts.

Any help would be appreciated

本文标签: androidHow to Access the Version of an Installed AAR Library in buildgradlektsStack Overflow