tribbloid tribbloid - 3 months ago 16x
Android Question

Maven refuse to download aar packaged dependency from remote repository

I want to use this android dependency in my java program:

so I added all the plugins & repositories into my maven pom file:





Then I add the dependency into the same file:


But nothing happens, maven ignore it as if it doesn't exist, if I import its main package in a scala file and build it with
mvn clear install -U
, I get this error:

[ERROR] /home/peng/git-drone/dronespike/src/main/scala/Main.scala:1: object o3dr is not a member of package com

[ERROR] import


Question: What should I do to fix this problem?


Use Android packaging, e.g. <packaging>apk</packaging>.

If Maven couldn't download the artifact, it would complain much sooner in the build lifecycle. The problem is that artifact is downloaded, but not used. aar is not a standard Maven artifact, so Maven doesn't know what to do with it. Using it requires a third party plugin with extensions, hence usage of android-maven-plugin. Reading its documentation, it has some requirements to work properly. Specifically you didn't use android packaging as mentioned here:

usage of a supported packaging: apk, aar or apklib

Indeed, looking at the plugin source code it checks for android packaging before adding anything from aar to classpath.