【问题标题】:Error: cannot find symbol import org.apache.cordova.CordovaWebViewClient;错误:找不到符号导入 org.apache.cordova.CordovaWebViewClient;
【发布时间】:2015-12-01 08:51:03
【问题描述】:

我已将fastcontextcordova 库添加到项目中 我收到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

【问题讨论】:

    标签: cordova cordova-plugins


    【解决方案1】:

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

    目前它指的是 CordovaWebViewClient。

    我们需要将其更改为 WebView。

    我认为没有sdk问题。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 2021-12-21
        • 2021-08-12
        • 1970-01-01
        • 1970-01-01
        • 2022-08-14
        • 2021-12-05
        • 1970-01-01
        • 1970-01-01
        • 2019-10-18
        相关资源
        最近更新 更多