Error while building a project with cordova google maps installed

When I install google-maps cordova plugin:

ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID=“my-key”

I can no loger successfully build my ionic project and get the following error after running ionic cordova build android:

[01:24:32] build dev started …
[01:24:33] clean started …
[01:24:33] clean finished in 32 ms
[01:24:33] copy started …
[01:24:33] transpile started …
[01:24:39] transpile finished in 6.82 s
[01:24:39] preprocess started …
[01:24:39] deeplinks started …
[01:24:40] deeplinks finished in 194 ms
[01:24:40] preprocess finished in 196 ms
[01:24:40] webpack started …
[01:24:40] copy finished in 7.50 s
[01:25:02] webpack finished in 22.88 s
[01:25:02] sass started …
[01:25:05] sass finished in 2.93 s
[01:25:05] postprocess started …
[01:25:05] removed unused font files
[01:25:05] postprocess finished in 47 ms
[01:25:05] lint started …
[01:25:06] build dev finished in 33.06 s

ionic cordova prepare
cordova prepare
√ Running command - done!

cordova run android
[01:25:15] lint finished in 9.41 s
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_xdwfshqv3vvp2szzuy7blfox.run(E:\projects\my-app\platforms\android\build.gradle:137)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

Errors during XML parse:
White spaces are required between publicId and systemId.
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 62; White spaces are required between publicId and systemId.
javax.xml.bind.UnmarshalException

  • with linked exception:
    [org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 62; White spaces are required between publicId and systemId.]
    Additionally, the fallback loader failed to parse the XML.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘android’.

java.lang.NullPointerException (no error message)

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or

BUILD FAILED

Total time: 57.887 secs
–debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘android’.

java.lang.NullPointerException (no error message)

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

[ERROR] An error occurred while running cordova run android (exit code 1).

And as soon as I remove the plugin:

ionic cordova plugin rm cordova-plugin-googlemaps

Everything gets back to normal and builds successfully. How can I get rid of this error?

Are you aware that the install command for that plugin is different in the documentation?

I have same problem for oneSignal plugin

Yes, even if I install with the following command I get the same build error:

ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID=“my-google-api-key”