pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
314 stars 584 forks source link

<edit-config> tags does not get copied over to config.xml on plugin install. #246

Closed Edmu closed 1 year ago

Edmu commented 5 years ago

Expected Behaviour

Copy over plugin.xml tags to project config.xml file on (re)install.

Actual Behaviour

tags from plugin.xml does not gets copied over to project config.xml on plugin install. #### Platform and Version (eg. Android 5.0 or iOS 9.2.1) Android 8.0.0 #### Cordova CLI info cli packages: (...) @ionic/cli-utils : 1.19.2 ionic (Ionic CLI) : 3.20.0 global packages: cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Gulp CLI : CLI version 3.9.1 Local version 3.9.1 local packages: @ionic/app-scripts : 3.1.6 Cordova Platforms : android 6.4.0 browser 5.0.3 ios 4.5.5 Ionic Framework : ionic-angular 3.9.2 System: Android SDK Tools : 26.1.1 ios-deploy : 2.0.0 Node : v9.11.1 npm : 2.15.12 #### Plugin version cordova-plugin-file-opener2 2.1.3 "File Opener2" #### Logs taken while reproducing problem ADB Logcat: 01-18 17:31:16.937 14504 14666 E PluginManager: Uncaught exception from plugin 01-18 17:31:16.937 14504 14666 E PluginManager: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference 01-18 17:31:16.937 14504 14666 E PluginManager: at android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:583) 01-18 17:31:16.937 14504 14666 E PluginManager: at android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:557) 01-18 17:31:16.937 14504 14666 E PluginManager: at android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:399) 01-18 17:31:16.937 14504 14666 E PluginManager: at io.github.pwlin.cordova.plugins.fileopener2.FileOpener2._open(FileOpener2.java:122) 01-18 17:31:16.937 14504 14666 E PluginManager: at io.github.pwlin.cordova.plugins.fileopener2.FileOpener2.execute(FileOpener2.java:67) 01-18 17:31:16.937 14504 14666 E PluginManager: at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98) 01-18 17:31:16.937 14504 14666 E PluginManager: at org.apache.cordova.PluginManager.exec(PluginManager.java:132) 01-18 17:31:16.937 14504 14666 E PluginManager: at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57) 01-18 17:31:16.937 14504 14666 E PluginManager: at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41) 01-18 17:31:16.937 14504 14666 E PluginManager: at android.os.MessageQueue.nativePollOnce(Native Method) 01-18 17:31:16.937 14504 14666 E PluginManager: at android.os.MessageQueue.next(MessageQueue.java:375) 01-18 17:31:16.937 14504 14666 E PluginManager: at android.os.Looper.loop(Looper.java:225) 01-18 17:31:16.937 14504 14666 E PluginManager: at android.os.HandlerThread.run(HandlerThread.java:65) ### Other comments Copying it manually from plugin.xml to config.xml helps but it's just workaround.
shnist commented 5 years ago

hi @Edmu, thanks for raising this issue. As a first step, please try updating to version 2.1.4 of the plugin, as 2.1.3 is deprecated. In the mean time I will see if I can reproduce the issue with the config you have.

Edmu commented 5 years ago

@shnist tried with v2.1.4 same issue. I suspect this may be due to low cordova-android version (v6.3.0) maybe this issue? https://issues.apache.org/jira/browse/CB-13514

Anyway it would be good to find out and maybe add some restriction via engine tag into plugin to prevent install on lower version if this is the cause of the issue?

shnist commented 5 years ago

@Edmu thanks for doing the research and pointing to a probable cause. Are you able to update your cordova android to see if the issue disappears?

agm commented 4 years ago

Provider tag is back here (cordova-android 8.0.0). Fix. No more 'Attempt to invoke virtual method...'

See cordova-plugin-camera provider.

shnist commented 4 years ago

thanks for this @agm, I will apply the same patch to this plugin.