久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android Gradle 實現與 CompileOnly 性能

Android Gradle Implementation vs CompileOnly Performance(Android Gradle 實現與 CompileOnly 性能)
本文介紹了Android Gradle 實現與 CompileOnly 性能的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

性能?

我認為 api 需要更多內存,因為 gradle 將快照該 transitive module 中的每個類,反之亦然implementation 是首選配置,因為(如上所述)它用于自己的內部實現.

The docs mention that implementation provides significant build time improvements over compile/api. What about compileOnly?

My use case is a multi-module (sorry I don't like Gradle's multi-project terminology) project, where I have an Android app, and multiple libraries that the app depends on (implementation). Some of the libraries also depend on one another. Should I use implementation or compileOnly when declaring dependencies in the library modules? My app module will be using implementation to depend on those artifacts, so I don't need them to be transitive through the library modules.

解決方案

The api configuration should be used for dependencies that are exported to external modules (transitive dependency). Vice-Versa implementation configuration should be used for dependencies that are internal to the component (not transitive dependency).

implementation vs compileOnly:

There is no similarity in their job, compileOnly is

  • a configuration inherited from java-plugin
  • required at compile time
  • also not included in the runtime classpath or exposed to dependent projects.

So compileOnly doesn't replace the implementation configuration job e.g:

implementation 'com.android.support:appcompat-v7:25.1.0' // can't use compileOnly here
testCompile 'junit:junit:4.12'

compile "com.google.dagger:dagger:2.8" // can't use here also
annotationProcessor "com.google.dagger:dagger-compiler:2.8" // can't use here also
compileOnly 'javax.annotation:jsr250-api:1.0' // we can use compileOnly here because it's required on run time only.

Since your case is a "multi-module", you have to use the api configuration, until you reach the final module it's better to use implementation.

Following graph describe those configurations:

Performance?

I think api requires more memory because gradle will snapshot every class in that transitive module, vice versa implementation is a preferred configuration because (as mentioned above) it's used for its own internal implementations.

這篇關于Android Gradle 實現與 CompileOnly 性能的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 久久国产精品一区二区三区 | 久久综合久色欧美综合狠狠 | 亚洲一区 | 野狼在线社区2017入口 | 午夜精品久久久久久不卡欧美一级 | 91精品国产一区二区三区香蕉 | 精品一级电影 | xx视频在线观看 | 欧美日韩一区二区电影 | 四虎最新 | 日韩av在线一区二区 | 国产小视频自拍 | 国产精品一区一区三区 | 欧美日韩综合视频 | 黄色片网此 | 亚洲精品久久区二区三区蜜桃臀 | 成人免费视频一区二区 | 五月天婷婷综合 | 成年网站在线观看 | 成人a视频在线观看 | 久久伊人一区二区 | 成人在线一区二区三区 | 99精品网 | 久久精品二区 | 91精品国产综合久久婷婷香蕉 | 亚洲精品日韩一区二区电影 | 一区二区三区四区不卡视频 | 国产精品揄拍一区二区久久国内亚洲精 | 波多野结衣中文字幕一区二区三区 | 亚洲福利一区二区 | 午夜电影福利 | 成人精品毛片 | 欧美在线视频一区二区 | 皇色视频在线 | 成人特级毛片 | 四虎影视1304t | 日韩精品视频一区二区三区 | 人人艹人人 | 日韩成人中文字幕 | 国产精品成人国产乱一区 | 成人影院在线观看 |