import java.nio.file.Files

// Required for Android Support Library 26.0.0+ and Google Play services 11.+
repositories {
  maven { url 'https://maven.google.com' }
}

gradle.afterProject { project ->
   def androidManifest = new File("${project.rootDir}/app/src/main/AndroidManifest.xml")
   String fileContentsReplaced = androidManifest.text.replaceFirst('<service .*android:name="com.huawei.hms.cordova.push.remote.HmsPushMessageService"(>[\\s]*<intent-filter>[\\s]*.*[\\s]*<\\/intent-filter>[\\s]*<\\/service>|.*[\\s]\\/>){1}', "")
   androidManifest.text = fileContentsReplaced
}