久久久久久久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欧美精品成人综合在线观看 | 亚洲成人福利视频 | 欧美一区在线视频 | 视频一区中文字幕 | 一区二区三区免费 | 午夜久久久久 | 国产女人与拘做受免费视频 | 成人免费观看视频 | 国产精品久久久久久久久久久久 | 亚洲精品一区二区在线观看 | 黄色三级免费网站 | 日韩三级一区 | 成人午夜免费福利视频 | 久草免费在线视频 | 一级a性色生活片久久毛片波多野 | 国产一区免费 | 国产伦一区二区三区视频 | 国产午夜精品一区二区三区嫩草 | 亚洲精品国产电影 | 97视频网站| 亚洲欧美日韩一区二区 | 久久久蜜臀国产一区二区 | 国产精品a久久久久 | 亚洲天堂一区 | 亚洲国产精品美女 | 国产成人在线视频免费观看 | 福利视频网 | 色综合一区二区 | 蜜臀久久99精品久久久久野外 | 精品成人 | 天天搞天天搞 | 久久国产电影 | 免费看黄视频网站 | 成人欧美一区二区 | 久久国产精品免费一区二区三区 | 91啪亚洲精品 | 日本成人中文字幕 | 国产精产国品一二三产区视频 | 精品欧美一区二区三区久久久 | 一区二区三区亚洲 | www.三级|