Consume binary AAR produced by another subproject

I have a multi-project build where a library project, some_lib, uses a cmake block and also builds a secondary aar file.

I have an app project which has a dependency to the some_lib project and to the aar:

dependencies {
    implementation(project(":some_lib"))
    implementation(files("../some_lib/path_to_an_aar/artifact.aar"))

As seen above, I have hard-coded the path to the aar, which is produced by the some_lib. If I try to build the app project without having built the some_lib first, Gradle complains because it can’t find the artifact.aar. So, I have to first run :some_lib:assembleDebug and then :app:assembleNormalDebug.

I read the documentation about sharing artifacts and a related question.

I think I should somehow create a configuration in some_lib that exposes the aar file, but I am not sure how to do this.