Android How aar with Dependency Tree Generates of Recommendation

  • 2021-08-12 03:36:48
  • OfStack

Introduction

Android Studio default aar will only contain the source code of this project, and will not carry the source code that library depends on; However, some of our commonly used dependency libraries 1 are generally dependent (by setting transitive = true To penetrate the dependency tree). The following explains how this aar with dependencies is generated

Code


apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'me.vigi.fat-aar'
buildscript {
  repositories {
    jcenter()
    maven {      url "http://dl.bintray.com/vigidroid/maven"
    }
  }
  dependencies {
    classpath 'me.vigi:fat-aar-plugin:0.2.8'
  }
}
dependencies {
  compile fileTree(dir: 'libs', include: ['*.jar'])
  compile 'com.android.support:appcompat-v7:26.1.0'
  embed 'com.google.auto.service:auto-service:1.0-rc2'
  embed 'com.squareup:javapoet:1.7.0'
}

As above code, someone has written a special plug-in to complete this function; For 3-party libraries that want to have dependencies, they can be introduced in the way of embed. 3-party plug-in Github address

Summarize


Related articles: