3

I'm going to create an android library (.aar) wrapping many Bluetooth devices SDK (.jar and .aar files). This files cannot be published in a Maven or alternative repositories.

Following these links (link1, link2), I've successfully added an .aar file as dependency module.

Building my library as .aar file I've noticed that the .jar and .aar dependency files are not embedded in the generated file. In fact, adding my library to a demo Android Application cause a Class not found exception.

I know that currently is available a library called FAT AAR providing the solution, but I'd like to know how to perform this operation without the library.

The build.gradle of the embedded .aar library is the following:

configurations.maybeCreate("default")
artifacts.add("default", file("xxxxxx_v2.5.3.aar"))

task clean(type: Delete) {
    delete rootProject.buildDir
}

group = "com.xxxxxx.ble.dev"
version = "2.5.3"

I've already tried to add in the dependencies section of my build.gradle library the following code, without any result.

api project(':name_of_the_module')
api project(':name_of_the_module', configuration: 'default')
implementation project(':name_of_the_module')
implementation project(':name_of_the_module', configuration: 'default')

My dev IDE is Android Studio Dolphin | 2021.3.1 Patch 1 Build #AI-213.7172.25.2113.9123335, built on September 30, 2022

Akamaccio
  • 79
  • 5
  • Have you discussed your plans with your attorney? Qualified legal counsel can advise you of whether what you intend to do complies with the license terms and other agreements associated with the "many Bluetooth devices SDK". – CommonsWare Oct 21 '22 at 11:13
  • 2
    I've been commissioned by a company which has a contract with all the manufacturers providing the SDKs. This is totally legal. In the end you didn't answer the question... – Akamaccio Oct 24 '22 at 07:49
  • "This is totally legal" -- for you, perhaps. My question was aimed partly at you and partly at those who stumble upon your question in the future. "In the end you didn't answer the question" -- that is because AFAIK there is no answer, at least at the present time. The Android build tools do not support this, and you are requesting a solution that does not involve third-party tools. I don't know if writing your own tools is considered an "answer" but, you could look at what the Gradle plugin that you linked to does and create your own. – CommonsWare Oct 24 '22 at 11:46
  • 2
    @CommonsWare "My question was aimed partly at you and partly at those who stumble upon your question in the future": Imho stackoverflow has a different aim, regarding the core development support. The legality or non legality of an action might not be point of discussion for this website. I hope that my idea is correct. "writing your own tools" could be an answer, but it use to raise another question...howto. Trying to interpret that code requires for sure a deep knowledge of Gradle (Groovy for me) language. It's quite strange that Google does not natively allow this. – Akamaccio Oct 24 '22 at 12:45
  • "It's quite strange that Google does not natively allow this" -- it's not that they allow or do not allow it. They simply have not written any tool support for it. There are lots and lots of things that they have not written. It is not Google's job to write every tool for every situation. – CommonsWare Oct 24 '22 at 12:57

0 Answers0