Reputation: 857
In Android studio in the "module settings" in the Dependencies tab you can select a scope for your library files. What is the difference between "compile" and "provided"?
Upvotes: 25
Views: 11768
Reputation: 1
What to say? To put it bluntly, compile or api
will exist during compilation and be packaged into the final project, and it can be transmitted to child dependencies for use. provided
only exists during compilation and does not exist when packaged into the final project. If there is no other place to continue to provide dependencies after packaged into the final project, an error will be reported, It is generally used to develop third-party jar packages, etc.
Upvotes: 0
Reputation: 34175
Gradle v3.0
includes next changes:
compile
-> api
- exposes dependency for consumer
provided
-> compileOnly
- is compile time dependency(not included into binary and isn't available in runtime) that is why it allows you to minify the size of final binary. Usually is used for annotation processor
Upvotes: 0
Reputation: 80010
compile
includes the library in your final APK, while provided
doesn't; provided
is a compile-time-only dependency.
Upvotes: 38