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

Android Gradle 實現(xiàn)與 CompileOnly 性能

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

問題描述

性能?

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

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.

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

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

相關(guān)文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現(xiàn) IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復(fù)“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應(yīng)用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 午夜快播 | 亚洲国产精 | 91午夜精品亚洲一区二区三区 | 国产精品久久久久久亚洲影视 | www.sihu| 国产三级在线观看 | 国产在线第一页 | 视频在线观看网站免费 | 亚洲性色av| 国产三级在线观看视频 | 国产不卡在线观看 | 夫妻av| 欧美日韩免费在线观看 | 婷婷色在线 | 中文字幕一区二区三区四区 | www.av在线 | 亚洲精品1| 成人看片网 | 久草视频免费看 | 日本视频免费观看 | 欧美精品一二三区 | 中文字幕在线视频观看 | 成人高清在线 | 国产精品久久久久久久久 | 欧美日韩精品 | 成人午夜又粗又硬又大 | 亚洲天堂免费视频 | 亚洲视频一区 | 亚洲免费在线 | 久久一区精品 | 黄色在线观看免费 | 国产精品一区av | 黄色a网站 | 亚色视频 | www.国产精品.com | www.爱爱 | 午夜激情在线观看 | 小日子的在线观看免费第8集 | 黄色一级片免费看 | 免费激情网站 | 性史性dvd影片农村毛片 |