我是科尔多瓦的新手, 我使用了几个用于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
建立失败
当我没有使用白名单插件时,它正常编译。
答案 0 :(得分:1)
这很可能是因为您使用旧版本的Cordova(< = v4.x)和最新的Whitelist插件(> = v5.x)。在Cordova 5中,他们将ConfigXmlParser
api切换为Context
而不是Activity
。