2016-11-26 117 views
1

我想aply google-services插件与firebase一起使用,但是由于我的一台笔记本电脑上的互联网访问湖,我无法连接到jecenter并添加插件。从本地jar添加插件到gradle buildscript

我已经下载了谷歌的服务-3.0.0.jar,但不知道在哪里添加它 以及如何实施

这个项目build.grdle

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 
    } 
} 

回答

2

我能够通过在我的lib文件夹中添加jar来从jar添加插件,并从项目gradle依赖关系中调用它,如下所示:

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 
    } 
}