@@ -27,13 +27,13 @@ function checkForGoogleServicesJson(projectDir, resourcesDir) {
2727 }
2828}
2929
30- function addOnPluginInstall ( platformsDir ) {
30+ function addOnPluginInstall ( platformsDir , resourcesDir ) {
3131 if ( buildGradleExists ( platformsDir ) ) {
32- addIfNecessary ( platformsDir ) ;
32+ addIfNecessary ( platformsDir , resourcesDir ) ;
3333 }
3434}
3535
36- function addIfNecessary ( platformsDir ) {
36+ function addIfNecessary ( platformsDir , resourcesDir ) {
3737 _amendBuildGradle ( platformsDir , function ( pluginImported , pluginApplied , fileContents ) {
3838 if ( ! pluginImported ) {
3939 fileContents . projectFileContents = _addPluginImport ( fileContents . projectFileContents ) ;
@@ -49,7 +49,7 @@ function addIfNecessary(platformsDir) {
4949 return fileContents ;
5050 } ) ;
5151
52- _copyGoogleServices ( platformsDir ) ;
52+ _copyGoogleServices ( resourcesDir , platformsDir ) ;
5353}
5454
5555function removeIfPresent ( platformsDir ) {
@@ -80,8 +80,8 @@ var _versionRegExp = '[^\'"]+';
8080var _pluginImportName = 'com.google.gms:google-services' ;
8181var _pluginApplicationName = 'com.google.gms.google-services' ;
8282
83- function _copyGoogleServices ( platformsDir ) {
84- var srcServicesFile = path . join ( platformsDir , '..' , 'app' , 'App_Resources' , 'Android' , 'google-services.json' ) ;
83+ function _copyGoogleServices ( resourcesDir , platformsDir ) {
84+ var srcServicesFile = path . join ( resourcesDir , 'Android' , 'google-services.json' ) ;
8585 var dstServicesFile = path . join ( platformsDir , 'android' , 'app' , 'google-services.json' ) ;
8686 if ( fs . existsSync ( srcServicesFile ) && ! fs . existsSync ( dstServicesFile ) && fs . existsSync ( path . join ( platformsDir , 'android' , 'app' ) ) ) {
8787 // try to copy google-services config file to platform app directory
@@ -130,15 +130,15 @@ function _removePluginApplication(buildGradleContents) {
130130function _addPluginImport ( buildGradleContents ) {
131131 var androidGradle = 'com.android.tools.build:gradle' ;
132132 var insertBeforeDoubleQuotes = 'classpath "' + androidGradle ;
133- var insertBeforeSingleQoutes = 'classpath \'' + androidGradle ;
133+ var insertBeforeSingleQuotes = 'classpath \'' + androidGradle ;
134134 var quoteToInsert = '"'
135135 var matchedString = insertBeforeDoubleQuotes ;
136136 var ind = buildGradleContents . indexOf ( insertBeforeDoubleQuotes ) ;
137137
138138 if ( ind === - 1 ) {
139- ind = buildGradleContents . indexOf ( insertBeforeSingleQoutes ) ;
139+ ind = buildGradleContents . indexOf ( insertBeforeSingleQuotes ) ;
140140 quoteToInsert = '\'' ;
141- matchedString = insertBeforeSingleQoutes ;
141+ matchedString = insertBeforeSingleQuotes ;
142142 }
143143
144144 if ( ind === - 1 ) {
0 commit comments