External Android library projects with Gradle

前端 未结 3 1986
醉话见心
醉话见心 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:06

    You are using an older version of the android gradle plugin.
    In the latest version 0.3 a lot has been improved in this area.

    I would advise you to upstep to version 0.3 of this plugin. Be also aware that you then have to use a more recent version of gradle (1.3 or 1.4).

    More information about how external libraries can be used in with this plugin.

    0 讨论(0)
  • 2021-01-04 02:12

    You can integrate the ActionBarSherlock as an aar now.

    Just add this to your dependency definition in your build.gradle file:

    dependencies {
        compile 'com.android.support:support-v4:18.0.+'
        compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
    

    Jake Wharton published an example project that shows how to use ActionBarSherlock with Gradle

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题