2016-11-26 38 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 
    } 
}