I have recently upgraded my Ionic/Cordova dev environment and am having issues rebuilding my project. Initially when building the project, I was getting an error as the cordova-plugin-device
plugin was used installed twice and thus couldnt be accessed by the phone.
I went to remove my android platform and re-add it so it would have to reinstall the plugins taking into account the dependencies for each plugin.
When I tried to add my platform back again, I received the Failed to require PlatformApi instance for platform "android". Using polyfill instead.
error which then cast an TypeError: Cannot read property 'replace' of undefined
error.
My development environment is as follows:
Cordova CLI: 5.4.0
Gulp version: CLI version 3.9.0
Gulp local:
Ionic Version: 1.1.0
Ionic CLI Version: 1.7.12
Ionic App Lib Version: 0.6.5
OS: Windows 10 Pro
Node Version: v5.3.0
This worked for me after experiencing the same problem
I have found that making sure that I had to make sure that I have that the id
attribute had to be filled in the <widget>
tag in the config.xml
file. i.e. it should look something like this <widget id="com.example.app" ...>
.
In my case I had removed the id
attribute because I was using android-packageName
and ios-CFBundleIdentifier
so I could have different package names (bundle identifier) for Android and iOS.