Is there a difference except that:
apply from:
- gets the (plugin).gradle from a URL
apply plugin:
- gets the (plugin).gradle from the gradle plugin server
#1 Use 'apply' to structure the script content In Gradle apply command can be used to apply not only plugins, but also script files (*). In this way you can divide your main build. gradle file into smaller parts, and move extra tasks like jacoco report and findbugs to the separate files.
Gradle will use the added plugins at the time of building the App. Dependecies are used to add some addtional code to your source code, so a dependency will make some extra code (like Classes in Java) in the form of library available for your source code.
There are two types of plugins one is script plugin and second is binary plugin.
apply plugin: 'android' specifies that It's an Android project but it does not specify Its an Application or Library project. To make life easier you can tell gradle the type of project and indicate which plugin should be used. I recommend to use apply plugin: 'com. android.
The actual difference between apply from:
and apply plugin:
is that the former is to be used for script plugins given a path to the local file system or a URL to a remote location, and the latter is used for binary plugins using the plugin id.
You can read more about it in Gradle documentation here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With