diff --git a/lib/constants.ts b/lib/constants.ts index 5145ac96ec..bf62d587fb 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -205,3 +205,5 @@ export class ProjectTemplateErrors { export class Hooks { public static createProject = "createProject"; } + +export const PACKAGE_PLACEHOLDER_NAME = "__PACKAGE__"; diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index 3567a47783..ea5bdb12b5 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -256,7 +256,10 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject try { // will replace applicationId in app/App_Resources/Android/app.gradle if it has not been edited by the user - shell.sed('-i', /__PACKAGE__/, projectData.projectId, projectData.appGradlePath); + const appGradleContent = this.$fs.readText(projectData.appGradlePath); + if (appGradleContent.indexOf(constants.PACKAGE_PLACEHOLDER_NAME) !== -1) { + shell.sed('-i', new RegExp(constants.PACKAGE_PLACEHOLDER_NAME), projectData.projectId, projectData.appGradlePath); + } } catch (e) { this.$logger.warn(`\n${e}.\nCheck if you're using an outdated template and update it.`); }