错误:无法找到符号导入org.apache.cordova.CordovaWebViewClient;

时间:2015-12-01 08:51:03

标签: cordova cordova-plugins

我已将fastcontext cordova库添加到项目中 我使用cordova build

收到以下错误
bonnie@bonnie ~/WorkStation/stage.js/example/game-orbit $ node -v
v4.2.2
bonnie@bonnie ~/WorkStation/stage.js/example/game-orbit $ npm -v
2.14.7
bonnie@bonnie ~/WorkStation/stage.js/example/game-orbit $ cordova -v
5.4.0
bonnie@bonnie ~/WorkStation/stage.js/example/game-orbit $ cordova build
Running command: /home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/cordova/build 
ANDROID_HOME=/home/bonnie/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
Running: /home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/gradlew cdvBuildDebug -b /home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:compileDebugJava
/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/src/com/piqnt/fastcontext/FastContextPlugin.java:7: error: cannot find symbol
import org.apache.cordova.CordovaWebViewClient;
                         ^
  symbol:   class CordovaWebViewClient
  location: package org.apache.cordova
/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/src/com/piqnt/fastcontext/FastContextPlugin.java:42: error: cannot find symbol
                    webView.addView(fastView);
                           ^
  symbol:   method addView(FastContextView)
  location: variable webView of type CordovaWebView
/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/src/com/piqnt/fastcontext/FastContextPlugin.java:51: error: cannot find symbol
                ViewGroup webParent = (ViewGroup) webView.getParent();
                                                         ^
  symbol:   method getParent()
  location: variable webView of type CordovaWebView
/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/src/com/piqnt/fastcontext/FastContextPlugin.java:58: error: no suitable method found for removeView(CordovaWebView)
                webParent.removeView(webView);
                         ^
    method ViewGroup.removeView(View) is not applicable
      (actual argument CordovaWebView cannot be converted to View by method invocation conversion)
    method ViewManager.removeView(View) is not applicable
      (actual argument CordovaWebView cannot be converted to View by method invocation conversion)
/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/src/com/piqnt/fastcontext/FastContextPlugin.java:62: error: no suitable method found for addView(CordovaWebView)
                newLayout.addView(webView);
                         ^
    method ViewGroup.addView(View,int,LayoutParams) is not applicable
      (actual and formal argument lists differ in length)
    method ViewGroup.addView(View,LayoutParams) is not applicable
      (actual and formal argument lists differ in length)
    method ViewGroup.addView(View,int,int) is not applicable
      (actual and formal argument lists differ in length)
    method ViewGroup.addView(View,int) is not applicable
      (actual and formal argument lists differ in length)
    method ViewGroup.addView(View) is not applicable
      (actual argument CordovaWebView cannot be converted to View by method invocation conversion)
/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/src/com/piqnt/fastcontext/FastContextPlugin.java:64: error: cannot find symbol
                webView.setBackgroundColor(Color.TRANSPARENT);
                       ^
  symbol:   method setBackgroundColor(int)
  location: variable webView of type CordovaWebView
/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/src/com/piqnt/fastcontext/FastContextPlugin.java:65: error: cannot find symbol
                webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
                       ^
  symbol:   method setLayerType(int,<null>)
  location: variable webView of type CordovaWebView
/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/src/com/piqnt/fastcontext/FastContextPlugin.java:66: error: cannot find symbol
                webView.setWebViewClient(new CordovaWebViewClient(cordova,
                                             ^
  symbol: class CordovaWebViewClient
8 errors
:compileDebugJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.498 secs

/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                    ^
Error code 1 for command: /home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /home/bonnie/WorkStation/stage.js/example/game-orbit/platforms/android/cordova/build: Command failed with exit code 1

2 个答案:

答案 0 :(得分:0)

请参阅how to install cordova plugin from a zip file

目前它正在引用CordovaWebViewClient。

我们需要将其更改为WebView。

我认为没有sdk问题。

答案 1 :(得分:-1)

尝试从SDK Manager安装Android版本工具版本21和22。