cordova-plugin-googlemaps: Build fails com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable not found

When I use the ionic-native google-maps plugin it gives the error class file for com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable not found

When running ionic run android:

Error: /ionic-app/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/ionic-app/platforms/android/src/plugin/google/maps/PluginUtil.java:135: error: cannot access AbstractSafeParcelable
    Builder builder = LatLngBounds.builder();
                                  ^
  class file for com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked 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.

My system:

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4-201612220408
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.48
ios-deploy version: Not installed
ios-sim version: 5.0.13
OS: OS X El Capitan
Node Version: v7.2.0
Xcode version: Xcode 8.2.1 Build version 8C1002

I found this on stackoverflow: http://stackoverflow.com/questions/41030573/ionic-v2-google-maps-api-android-build-error-cannot-access-abstractsafeparcelab

But I think it should work without tinkering inside the platforms folder.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (1 by maintainers)

Most upvoted comments

Hi,

What is happening is not loading latest google play service and support. So, my fix is that I changed:

cordova.system.library.3=com.google.android.gms:play-services-location:9.8.0
cordova.system.library.4=com.android.support:support-v4:9.8.0

On project.properties file to:

cordova.system.library.3=com.google.android.gms:play-services-location:+
cordova.system.library.4=com.android.support:support-v4:+

If it doesn’t work, also change this two guys:

cordova.system.library.1=com.google.android.gms:play-services-maps:+
cordova.system.library.2=com.google.android.gms:play-services-location:+

I hope that helps 😃

I had the same problem, but I use the plugin normally because it seems that this problem happen only with version 1.4 of the plugin. You can try:

$ ionic plugin rm cordova-plugin-googlemaps
$ ionic plugin add cordova-plugin-googlemaps@1.3.9 --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"

It isn’t a solutions, but it’ll help you to use the plugin. It worked for me until the moment.

Hi every body, I face the same issues, but all solution here is not working, I am using ionic 2