I'd like to apply the google-services
Gradle plugin to a Java project from a local jar, such that my build does not need to connect to jcenter to download the plugin.
I have downloaded the google-services-3.0.0.jar
, but I don't know how to tell gradle to load the plugin from the file.
This is my build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.google.gms:google-services:3.0.0' <---i have the jar
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
While creating a custom plugin, you need to write an implementation of plugin. Gradle instantiates the plugin and calls the plugin instance using Plugin. apply() method. The following example contains a greeting plugin, which adds a hello task to the project.
To use the plugin, simply execute the task named init where you would like to create the Gradle build.
I was able to add the plugin from the jar by adding the jar in my lib folder and call it from the project gradle dependencies like so :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath fileTree(include: ['*.jar'], dir: 'app/libs')
classpath files('app/libs/google-services-3.0.0.jar')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
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