From 28c10dba092df566611ef8f70787b6db2cff4d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Nilsen?= Date: Wed, 4 Dec 2013 21:06:15 +0100 Subject: [PATCH] CB-5481 Fix for Cordova trying to get config.xml from the wrong namespace --- framework/src/org/apache/cordova/Config.java | 9 +++++++-- framework/src/org/apache/cordova/PluginManager.java | 11 ++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/framework/src/org/apache/cordova/Config.java b/framework/src/org/apache/cordova/Config.java index e5609614..eeedaf20 100644 --- a/framework/src/org/apache/cordova/Config.java +++ b/framework/src/org/apache/cordova/Config.java @@ -68,10 +68,15 @@ public class Config { return; } + // First checking the class namespace for config.xml int id = action.getResources().getIdentifier("config", "xml", action.getClass().getPackage().getName()); if (id == 0) { - LOG.i("CordovaLog", "config.xml missing. Ignoring..."); - return; + // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml + id = action.getResources().getIdentifier("config", "xml", action.getPackageName()); + if (id == 0) { + LOG.i("CordovaLog", "config.xml missing. Ignoring..."); + return; + } } // Add implicitly allowed URLs diff --git a/framework/src/org/apache/cordova/PluginManager.java b/framework/src/org/apache/cordova/PluginManager.java index 0b9ecc77..e9795e86 100755 --- a/framework/src/org/apache/cordova/PluginManager.java +++ b/framework/src/org/apache/cordova/PluginManager.java @@ -110,11 +110,16 @@ public class PluginManager { * Load plugins from res/xml/config.xml */ public void loadPlugins() { + // First checking the class namespace for config.xml int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getClass().getPackage().getName()); if (id == 0) { - this.pluginConfigurationMissing(); - //We have the error, we need to exit without crashing! - return; + // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml + id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getPackageName()); + if (id == 0) { + this.pluginConfigurationMissing(); + //We have the error, we need to exit without crashing! + return; + } } XmlResourceParser xml = this.ctx.getActivity().getResources().getXml(id); int eventType = -1;