繁体   English   中英

Android构建因cordova-whitelist-plugin失败

[英]Android build failed with cordova-whitelist-plugin

我是Cordova的新手,我为Cordova使用了两个插件,其中一个是Whitelist插件。 当我将白名单插件添加到我的cordova项目中并从Eclipse在android设备上运行时,出现以下错误。

-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

建立失败

当我不使用白名单插件时,其编译正常。

这很可能是因为您使用的是旧版本的Cordova(<= v4.x)和最新的白名单插件(> = v5.x)。 在Cordova 5中,他们切换了ConfigXmlParser api以采用Context而不是Activity

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM