The compile
setting is deprecated
It's one of the great changes coming from gradle: 3.0, which google announced in 2017 on google I / O
The compile
setting is now deprecated and you should replace with implementation
or api
. Where api
configuration should be used to declare dependencies on which to export from the API library, whereas implementation
must be used to declare dependencies in which the component is used internally. Example:
dependencies {
api 'commons-httpclient:commons-httpclient:3.1'
implementation 'org.apache.commons:commons-lang3:3.5'
}
Dependencies that appear in the api
setting will be transitively exposed to the library's consumers and as such will appear on the consumer compile path.
Dependencies found in the implementation
setting, on the other hand, will not be exposed to consumers and therefore will not be leaked to the consumer compilation classpath. This allows faster compilation thanks to the reduced size of the classpath.
If you have a knowledge of English, here's the documentation .
Replace in your code:
- compile by implementation
- testCompile by testImplementation
- debugCompile by debugImplementation
- androidTestCompile by androidTestImplementation
This article talks a little about this and others changes that occurred in the new version. In addition to showing how to migrate from an older version of gradle to the most current one.
The Compile
setting still exists, but should not be used because it does not provide the guarantees that the api
and implementation
settings provide.