Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
109 stars 139 forks source link

Support for Cordova-Android 7 #288

Closed davidofwatkins closed 6 years ago

davidofwatkins commented 6 years ago

This addresses an issue with the latest version of the Cordova CLI (7+). The <config-file> settings in plugin.xml need to point to a config file (config.xml). Without that, Cordova was giving me a vague TypeError: Path must be a string. Received undefined error.

wfhm commented 6 years ago

Hey,

Could you please provide us with a simple reproducer project for your issue so we could figure out if this change is required, and whether it is an optimal solution?

davidofwatkins commented 6 years ago

Hi there, sorry for the delayed response!

After digging a little deeper, it turns out this may be a deeper bug with Cordova 7+. I'm able to reproduce it on your own pushwoosh-phonegap-cordova-sample project (using cordova 7.1.0 and cordova-android 7.1.0), only if I add the following to its config.xml, as I have in my own project:

<platform name="android">
    <config-file parent="/*" target="app/src/main/AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-feature android:name="android.hardware.microphone" android:required="false" />
        <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
        <uses-feature android:name="android.hardware.camera.flash" android:required="false" />
    </config-file>
</platform>

It seems that these <config-file> settings in config.xml are breaking plugins that have <config-file> with no target defined (like yours). Others have run into the same problem, and there's an official Cordova bug for it here.

So, it sounds like Cordova should fix this, but I wonder if plugins such as yours should declare a specific <config-file> target anyway?

Textras commented 6 years ago

@davidofwatkins Also experiencing this. Did you try to remove the "config-file" tags from my config.xml? Not ideal but might work. So frustrating bug was created: 06/Nov/17 and updated: 10/Apr/18 but still nada.

@wfhm did you find a workaround or solution?

wfhm commented 6 years ago

@Textras @davidofwatkins apologies for the delay. This issue is only reproducible with cordova 7.1.0. Upgrading to 8.+ solves the issue.