iOS & Android Native Build Errors with Cordova Plugins

March 20, 2017

Lately I encountered some native build errors that slowed me down quite a bit. Here is an overview of some of them, their issue and solution which might save you some time if you come across one of the following native errors:

  • iOS: ‘GoogleCloudMessaging.h’ file not found
  • iOS: Duplicate Symbols
  • Android: safeparcel.AbstractSafeParcelable not found
  • Android: Force Close due to phonegap-push-plugin
Native build error

iOS: ‘GoogleCloudMessaging.h’ file not found

error: ‘GoogleCloudMessaging.h’ file not found
#import "GoogleCloudMessaging.h"
Lexical or Preprocessor Issue
> ‘GoogleCloudMessaging.h’ file not found
> PushPlugin.m


Cordova supports CocoaPods since 4.3.0. The issue here is that 2 pods don’t load correctly and you need to add them manually in your ./platforms/ios/Podfile like in the solution.


platform :ios, '7.0'
target 'JustWatch' do
	pod 'GoogleCloudMessaging'
	pod 'GGLInstanceID'

…and then in ./platforms/ios do a pod install.

iOS: Duplicate Symbols

ld: 270 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


phonegap-plugin-push and cordova-plugin-googleplus have common dependencies, but both add them separately which causes the duplicate symbols.


  • Open your project with XCode.
  • Go to “Build Phases” and access to “Link Binary With Libraries”
  • Remove these libraries:
- libGTMSessionFetcher_core.a
- libGTMSessionFetcher_full.a
- libGTM_AddressBook.a
- libGTM_core.a
- libGTM_GTMURLBuilder.a
- libGTM_iPhone.a
- libGTM_KVO.a
- libGTM_Regex.a
- libGTM_StringEncoding.a
- libGTM_SystemVersion.a

As suggested here by @ideatia:

Android: safeparcel.AbstractSafeParcelable not found error: cannot access AbstractSafeParcelable
    Builder builder = LatLngBounds.builder();
    class file for not found


Two plugins are using the same play services dependencies but with different versions that are explicitly set and therefore can’t use two different dependency versions.


Unpin the play-services-map and play-services-location by adding this Cordova plugin fork directly: ionic plugin add

Android: Force Close due to phonegap-push-plugin

E/AndroidRuntime( 2059): FATAL EXCEPTION: pool-1-thread-3
E/AndroidRuntime( 2059): Process: com.justwatch.justwatch, PID: 2059
E/AndroidRuntime( 2059): java.lang.NoSuchMethodError: No static method getNoBackupFilesDir(Landroid/content/Context;)Ljava/io/File; in class Lcom/google/android/gms/common/util/zzw; or its super classes (declaration of ‘’ appears in /data/app/com.justwatch.justwatch-1/base.apk)
E/AndroidRuntime( 2059): at Source)
E/AndroidRuntime( 2059): at<init>(Unknown Source)
E/AndroidRuntime( 2059): at<init>(Unknown Source)
E/AndroidRuntime( 2059): at Source)
E/AndroidRuntime( 2059): at Source)
E/AndroidRuntime( 2059): at com.adobe.phonegap.push.PushPlugin$
E/AndroidRuntime( 2059): at java.util.concurrent.ThreadPoolExecutor.runWorker(
E/AndroidRuntime( 2059): at java.util.concurrent.ThreadPoolExecutor$
E/AndroidRuntime( 2059): at


Google Play GCM dependencies have changed here which made the phonegap-push-plugin have to adjust accordingly, otherwise wrong method signatures will be called which causes a force close.


Update to latest phonegap-push-plugin version or basically everything after 1.8.4.

Simon Wicki

Simon Wicki is a Freelance Frontend Developer in Berlin. Passionate and fluent in Vue, Angular, React and Ionic. Interested in Tech, frontend & non-fiction books

Twitter Follow @zwacky