Skip to content

Commit 5422e25

Browse files
jquick-axwayhansemannnssekhri
authored
feat(android)(9_0_X): add "google-services.json" support (#11514)
* chore(android): handle google-services.json * chore: add gradle plugin condition * chore(android): add google-services.json support to app template Co-authored-by: hansemannn <hans.knoechel@hs-osnabrueck.de> Co-authored-by: Hans Knöchel <hansemannn@users.noreply.github.com> Co-authored-by: ssekhri <ssekhri@axway.com>
1 parent 764f024 commit 5422e25

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

android/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ buildscript {
1313
jcenter()
1414
}
1515
dependencies {
16+
classpath 'com.google.gms:google-services:4.3.3'
1617
classpath 'com.android.tools.build:gradle:3.6.0'
1718
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1819
}

android/cli/commands/_build.js

+7
Original file line numberDiff line numberDiff line change
@@ -2251,6 +2251,13 @@ AndroidBuilder.prototype.generateAppProject = async function generateAppProject(
22512251
}
22522252
}
22532253

2254+
constgoogleServicesFile=path.join(this.projectDir,'platform','android','google-services.json');
2255+
if(awaitfs.exists(googleServicesFile)){
2256+
afs.copyFileSync(googleServicesFile,path.join(this.buildAppDir,'google-services.json'),{
2257+
logger: this.logger.debug
2258+
});
2259+
}
2260+
22542261
// Copy Titanium project's "./platform/android" directory tree to "app" project's "./src/main".
22552262
// Android build tools auto-grabs folders named "assets", "res", "aidl", etc. in this folder.
22562263
// Note: Our "build.gradle" is configured to look for JAR/AAR files here too. (Needed by hyperloop.)

android/templates/build/app.build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

22
apply plugin: 'com.android.application'
33

4+
// Apply the Google Services plugin if included
5+
if (file("${projectDir}/google-services.json").exists()) {
6+
apply plugin: 'com.google.gms.google-services'
7+
}
8+
49
repositories {
510
<%if (mavenRepositoryUrls) { for (let nextUrl of mavenRepositoryUrls) { %>
611
maven { url '<%- nextUrl %>' }

android/templates/build/root.build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
}
99
dependencies {
1010
classpath 'com.android.tools.build:gradle:3.6.0'
11+
classpath 'com.google.gms:google-services:4.3.3'
1112
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1213
}
1314
}

0 commit comments

Comments
 (0)
close