External Android library projects with Gradle

前端 未结 3 2006
醉话见心
醉话见心 2021-01-04 01:40

I am trying to build an Android project with Gradle and the Android Gradle plugin. I would like to depend on library projects found in external (maven) repositories, e.g. Ac

3条回答
  •  一向
    一向 (楼主)
    2021-01-04 02:22

    While it is possible to get dependencies through a Maven or Ivy repository, those are not packaged in a standard Jar archive. There is a new format designed specifically for this build system. The type is 'aar'

    Current Android Libraries available on Maven Central were created using the Maven plugin which use a different archive format ('apklib') so they are not compatible.

    If you look at com.actionbarsherlock:actionbacksherlock (which is the new location of that library), you'll see its format is apklib. http://search.maven.org/#artifactdetails%7Ccom.actionbarsherlock%7Cactionbarsherlock%7C4.2.0%7Capklib

    Looking at the source code, we check for 'aar' packaging and revert to processing all others as 'jar' which is obviously a problem here. We should detect apklib and provide a better error message.

提交回复
热议问题