简体   繁体   中英

Adding jar file in libs vs. adding dependencies in gradle

We are using projectlombok in our android app. Our approach to use this library is - We have added lombok.jar to the android studio - inside libs folder and using compile files('libs/lombok.jar')

However, on the project home page of projectlombok the approach explained to add it is like below,

dependencies {
    compileOnly 'org.projectlombok:lombok:1.16.18'
}

Is there any performance or app-size impact of one approach over the other?

One of the biggest differences is the amount of work required to upgrade to a new version of the library. If you use Gradle, then all it takes is a small edit to your build.gradle file. The other option requires downloading the JAR file manually and copying it to the libs directory.

For JAR-only libraries, this difference is pretty small. However, for libraries which also include Android resources, a JAR file is insufficient. You have to build a AAR file instead and bring it into your build process. Gradle manages all of this for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM