پس از بروزرسانی به اندروید ۳ و گردل ۳ اگه یه سر به فایل build.gradle بزنید می بیندی که تمام compile ها شدند implementation که این یکی از تغییراتی است که گوگل با انتشار گردل ۳ اون رو در اینجا ارائه کرده. و از این به بعد به جای compile باید از implementationاستفاده بشه.
در ذیل نیز قسمتی از اسناد گردل در این مورد رو می بینید:
dependencies {
api 'commons-httpclient:commons-httpclient:3.1'
implementation 'org.apache.commons:commons-lang3:3.5'
}
Dependencies appearing in the api
configurations will be transitively exposed to consumers of the library, and as such will appear on the compile classpath of consumers.
Dependencies found in the implementation
configuration will, on the other hand, not be exposed to consumers, and therefore not leak into the consumers’ compile classpath. This comes with several benefits:
- dependencies do not leak into the compile classpath of consumers anymore, so you will never accidentally depend on a transitive dependency
- faster compilation thanks to reduced classpath size
- less recompilations when implementation dependencies change: consumers would not need to be recompiled
- cleaner publishing: when used in conjunction with the new maven-publish plugin, Java libraries produce POM files that distinguish exactly between what is required to compile against the library and what is required to use the library at runtime (in other words, don’t mix what is needed to compile the library itself and what is needed to compile against the library).
The compile configuration still exists but should not be used as it will not offer the guarantees that the api and implementation configurations provide.
و اما تغییرات به شکل زیر می شوند:
compile تبدیل به implementation
testCompile تبدیل به testImplementation
debugCompile تبدیل به debugImplementation
androidTestCompile تبدیل به androidTestImplementation
compileOnly اما هنوز پا برجاست :)
دیدگاهتان را بنویسید