When I attempt to build my project using gradle, I get the following error:
Failed to resolve: com.trnql:lib-release 1.0.0
It seems it cannot find the android archive file (aar) that is in the libs folder. The dependencies section of the build.gradle file looks like this:
And the project structure looks like this:
The aar file is valid, it is just not resolved by the build system. What can I do to fix this problem?
Add your AAR or JAR as a dependency Navigate to File > Project Structure > Dependencies. In the Declared Dependencies tab, click and select Jar Dependency in the dropdown. In the Add Jar/Aar Dependency dialog, first enter the path to your . aar or .
Uploading Android AAR to Local Maven RepositoryCreate an empty project without any activity. Create an AAR module. The URL file:\\DESKTOP-3PCHU10\site\ is a shared folder. Add “apply from: 'maven-publish.
flatDir(configureClosure) Adds an configures a repository which will look for dependencies in a number of local directories. flatDir(args) Adds a resolver that looks into a number of directories for artifacts. The artifacts are expected to be located in the root of the specified directories.
compileOnly. Gradle adds the dependency to the compile classpath only (that is, it is not added to the build output). This is useful when you're creating an Android module and you need the dependency during compilation, but it's optional to have it present at runtime.
put your aar file in libs dir, then modify part of your build.gradle file like below, the difference is that you missed *.aar when compile fileTree
repositories {
flatDir {
dirs 'libs'
}
}
compile fileTree(dir:'libs', include:['*.jar', '*.aar'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With