将Crosswalk插件添加到Cordova Android项目后构建错误

时间:2016-01-28 14:09:42

标签: android cordova crosswalk

我正在使用最新的cordova android(5.1.0)。该项目正在构建并运行良好,没有人行横道,但在我使用

添加了crosswalk插件之后
cordova plugin add https://github.com/crosswalk-project/cordova-plugin-crosswalk-webview.git

我收到以下构建错误:

Error:15:53:54.127 [ERROR] [system.err] /Users/or/Projects/Test/cordova/platforms/android/src/org/crosswalk/engine/    XWalkWebViewEngine.  java:48: error: cannot find symbol
  15:53:54.127 [ERROR] [system.err] import org.xwalk.core.XWalkGetBitmapCallback;
  15:53:54.128 [ERROR] [system.err]                      ^
  15:53:54.128 [ERROR] [system.err]   symbol:   class XWalkGetBitmapCallback
  15:53:54.128 [ERROR] [system.err]   location: package org.xwalk.core
  15:53:54.178 [ERROR] [system.err] /Users/or/Projects/Test/cordova/platforms/android/src/org/crosswalk/engine/XWalkWebViewEngine.      java:103: error: cannot find symbol
  15:53:54.179 [ERROR] [system.err]                                     new XWalkGetBitmapCallback() {
  15:53:54.179 [ERROR] [system.err]                                         ^
  15:53:54.180 [ERROR] [system.err]   symbol: class XWalkGetBitmapCallback
  15:53:54.181 [ERROR] [system.err] /Users/or/Projects/Test/cordova/platforms/android/src/org/crosswalk/engine/XWalkWebViewEngine.      java:207: error: cannot find symbol
  15:53:54.182 [ERROR] [system.err]             webView.getExtensionManager().loadExtension(XWALK_EXTENSIONS_FOLDER + File.separator     +   path);
  15:53:54.182 [ERROR] [system.err]                    ^
  15:53:54.182 [ERROR] [system.err]   symbol:   method getExtensionManager()
  15:53:54.182 [ERROR] [system.err]   location: variable webView of type XWalkCordovaView
  15:53:54.184 [ERROR] [system.err] /Users/or/Projects/Test/cordova/platforms/android/src/org/crosswalk/engine/XWalkCordovaView.    java:93:   error: method does not override or implement a method from a supertype
  15:53:54.185 [ERROR] [system.err]     @Override
  15:53:54.185 [ERROR] [system.err]     ^
  15:53:54.188 [ERROR] [system.err] Note: Some input files use or override a deprecated API.
  15:53:54.188 [ERROR] [system.err] Note: Recompile with -Xlint:deprecation for details.
  15:53:54.188 [ERROR] [system.err] 4 errors
  15:53:54.190 [ERROR] [org.gradle.BuildExceptionReporter] 
  15:53:54.190 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
  15:53:54.191 [ERROR] [org.gradle.BuildExceptionReporter] 
  15:53:54.191 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
  15:53:54.191 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':compileX86DebugJavaWithJavac'.
  15:53:54.191 [ERROR] [org.gradle.BuildExceptionReporter] > Compilation failed; see the compiler error output for details.
  15:53:54.191 [ERROR] [org.gradle.BuildExceptionReporter] 
  15:53:54.191 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
  15:53:54.192 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 

该项目是使用Android Studio构建的。

有人遇到过类似的东西吗?

由于

4 个答案:

答案 0 :(得分:50)

如果使用Ionic(不确定框架的另一个平台是否也这样做),root config.xml模板包含以下参考:

<preference name="xwalkVersion" value="17+" />

删除它并触发

cordova build android 

(以及@badboyunited的回答)会导致插件以最新版本下载。

答案 1 :(得分:16)

试试这个,它为我工作。

您必须在添加Android平台之前添加插件。

cordova -version ==> 5.1.1
  1. 导航到项目目录

      

    cd cordova /

  2. 删除Android平台

      

    cordova platform rm android

  3. 检查未安装的crosswalk插件

      

    cordova插件ls

  4. 使用npm

    添加crosswalk插件
      

    cordova插件添加cordova-plugin-crosswalk-webview

  5. 添加Android平台

      

    cordova平台添加android

  6. 构建android项目

      

    cordova build android

  7. 运行android项目

      

    cordova运行android

答案 2 :(得分:0)

安装Crosswalk后遇到问题,我找到了一个适合我的解决方案:https://crosswalk-project.org/jira/si/jira.issueviews:issue-html/XWALK-5965/XWALK-5965.html

tl; dr:安装&#34; Android支持库&#34;来自extras存储库(来自Android SDK管理器)

答案 3 :(得分:-2)

将xwalkVersion首选项更改为18 +

https://crosswalk-project.org/jira/browse/XWALK-7043