Search code examples
androidionic-frameworkcordova-pluginswhitelist

Android build failed with cordova-whitelist-plugin


I'm new to the cordova, I'm using a couple of plugins for cordova and one of them is Whitelist plugin. When i add the whitelist plugin to my cordova project and running on android device from eclipse the following errors i'm getting.

-compile:
   [javac] Compiling 31 source files to D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\bin\classes
   [javac] D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\src\org\apache\cordova\whitelist\WhitelistPlugin.java:42: error: no suitable method found for parse(Context)
   [javac]         new CustomConfigXmlParser().parse(context);
   [javac]                                    ^
   [javac]     method ConfigXmlParser.parse(XmlResourceParser) is not applicable
   [javac]       (actual argument Context cannot be converted to XmlResourceParser by method invocation conversion)
   [javac]     method ConfigXmlParser.parse(Activity) is not applicable
   [javac]       (actual argument Context cannot be converted to Activity by method invocation conversion)
   [javac] D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\src\org\apache\cordova\whitelist\WhitelistPlugin.java:46: error: no suitable method found for parse(XmlPullParser)
   [javac]         new CustomConfigXmlParser().parse(xmlParser);
   [javac]                                    ^
   [javac]     method ConfigXmlParser.parse(XmlResourceParser) is not applicable
   [javac]       (actual argument XmlPullParser cannot be converted to XmlResourceParser by method invocation conversion)
   [javac]     method ConfigXmlParser.parse(Activity) is not applicable
   [javac]       (actual argument XmlPullParser cannot be converted to Activity by method invocation conversion)
   [javac] D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\src\org\apache\cordova\whitelist\WhitelistPlugin.java:64: error: no suitable method found for parse(Context)
   [javac]             new CustomConfigXmlParser().parse(webView.getContext());
   [javac]                                        ^
   [javac]     method ConfigXmlParser.parse(XmlResourceParser) is not applicable
   [javac]       (actual argument Context cannot be converted to XmlResourceParser by method invocation conversion)
   [javac]     method ConfigXmlParser.parse(Activity) is not applicable
   [javac]       (actual argument Context cannot be converted to Activity by method invocation conversion)
   [javac] D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\src\org\apache\cordova\whitelist\WhitelistPlugin.java:69: error: method does not override or implement a method from a supertype
   [javac]         @Override
   [javac]         ^
   [javac] D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\src\org\apache\cordova\whitelist\WhitelistPlugin.java:106: error: method does not override or implement a method from a supertype
   [javac]         @Override
   [javac]         ^
   [javac] D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\src\org\apache\cordova\whitelist\WhitelistPlugin.java:111: error: method does not override or implement a method from a supertype
   [javac]     @Override
   [javac]     ^
   [javac] D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\src\org\apache\cordova\whitelist\WhitelistPlugin.java:119: error: method does not override or implement a method from a supertype
   [javac]     @Override
   [javac]     ^
   [javac] D:\software\eclipse\configuration\org.eclipse.osgi\1099\data\proj_gen\GoFindoMobile\android\src\org\apache\cordova\whitelist\WhitelistPlugin.java:130: error: method does not override or implement a method from a supertype
   [javac]     @Override
   [javac]     ^
   [javac] Note: Some input files use or override a deprecated API.
   [javac] Note: Recompile with -Xlint:deprecation for details.
   [javac] 8 errors

BUILD FAILED

When i'm not using the White list plugin Its compiling normally.


Solution

  • This is most likely because you are using an older version of Cordova (<= v4.x) with the newest Whitelist plugin (>= v5.x). In Cordova 5 they switched the ConfigXmlParser api to take a Context instead of an Activity.