Fixing GoogleMaps Android build error with AbstractSafeParcelable not found message

May 24, 2017, 6:56 pm Categories:


After adding the Ionic Native GoogleMaps plugin to a recent project I encountered the following error when trying to generate/run an Android build:

/my-project/platforms/android/src/plugin/google/maps/ error: cannot access AbstractSafeParcelable

    Builder builder = LatLngBounds.builder();
  class file for not found

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

1 error


FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

* Try:

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

Talk about an unwelcome guest but how to fix this?

My first port of call was the tried-and-tested approach of un-installing/re-installing both the Android platform and the Ionic Native GoogleMaps plugin to see if this would resolve the issue.

It didn't.

Hmm - not a good sign.

After a little Googling, followed by some time on StackOverflow (and, let's be honest here, where would we developers be without that particular website?) I found my answer.

Handling your properties

If you're trying to run Android builds with the Ionic Native GoogleMaps plugin and hit the same errors you'll be pleased to know that the solution is surprisingly quick and easy to implement.

Begin by updating your Android SDK to the latest version then, in your platforms/android/ file, locate these two lines:

And replace those with the following values instead:

Notice this just involves substituting the versioning numbers with a + symbol?

This simply loads the latest Google Play libraries for those services.

Save those changes and, upon re-running the build process, you should find this solves the issue (it worked for me at least).

In Summary

Build problems are always frustrating to deal with, particularly when those project deadlines are looming ever closer.

If you find your Android builds breaking with the same errors that are listed above then hopefully this short tutorial will help you fix those.

If you enjoyed or found useful what you've read here then please sign up to my mailing list and, if you haven't done so already, take a look at my e-book: Mastering Ionic for information about troubleshooting further issues when developing with the Ionic Framework and Ionic Native/Cordova plugins.



Post a comment

All comments are welcome and the rules are simple - be nice and do NOT engage in trolling, spamming, abusiveness or illegal behaviour. If you fail to observe these rules you will be permanently banned from being able to comment.