安装cordova-plugin-local-notification报错:xml/localnotification_provider_paths未找到
Hey, I've run into this exact error before when working with the cordova-plugin-local-notification in Ionic/Cordova—let me walk you through the fixes that worked for me and other developers:
Common Solutions to Try
1. Install a Compatible Plugin Version
Sometimes the latest plugin version has compatibility hiccups with your Cordova Android platform. Try installing a stable, well-tested version instead:
ionic cordova plugin add cordova-plugin-local-notification@0.9.0-beta.2
Note: Check the plugin's release notes to match the version with your Cordova Android platform (e.g., Android 11+ pairs well with newer beta builds).
2. Manually Add the Missing XML File
The error means the plugin failed to generate the required localnotification_provider_paths.xml file. Create it manually to fill the gap:
- Navigate to your project's Android resources folder:
platforms/android/app/src/main/res/xml - Create a new file named
localnotification_provider_paths.xmlwith this content:
<?xml version="1.0" encoding="utf-8"?> <paths xmlns:android="http://schemas.android.com/apk/res/android"> <external-path name="external_files" path="."/> </paths>
This file defines the file provider paths the plugin needs to access local resources.
3. Clean and Rebuild Your Cordova Project
Corrupted platform files or cached configurations are often the culprit. Reset your Android platform and plugin to start fresh:
# Remove the plugin first ionic cordova plugin rm cordova-plugin-local-notification # Remove the Android platform ionic cordova platform rm android # Re-add a compatible Android platform version (adjust based on your project needs) ionic cordova platform add android@11.0.0 # Reinstall the plugin ionic cordova plugin add cordova-plugin-local-notification
4. Verify Config.xml Provider Configuration
Make sure the plugin's file provider entry exists in your config.xml under the Android platform section. If it's missing, add it manually:
<platform name="android"> <!-- Other Android configurations --> <provider android:authorities="${applicationId}.localnotification.provider" android:exported="false" android:name="de.appplant.cordova.plugin.localnotification.NotificationProvider"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/localnotification_provider_paths" /> </provider> </platform>
After trying these steps, run ionic cordova build android again—this should resolve the missing resource error.
内容的提问来源于stack exchange,提问作者Zulfiqar Ali




