Cordova 5建筑使用了两个等级/蚂蚁抛出java编译错误

时间:2015-06-13 12:34:14

标签: java android cordova ant gradle

安装了Android SDK Manager中列出的所有工具。

JAVA_HOME指向jdk7

GRADLE_HOME,ANT_HOME,ANDROID_HOME是其他正确配置的环境变量。

已经尝试过删除&再次将平台android添加到cordova项目中。

C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\CordovaClientCertRequest.java:25: error: cannot find symbol
import android.webkit.ClientCertRequest;
                     ^
  symbol:   class ClientCertRequest
  location: package android.webkit
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\CordovaClientCertRequest.java:32: error: cannot find symbol
    private final ClientCertRequest request;
                  ^
  symbol:   class ClientCertRequest
  location: class CordovaClientCertRequest
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\CordovaClientCertRequest.java:34: error: cannot find symbol
    public CordovaClientCertRequest(ClientCertRequest request) {
                                    ^
  symbol:   class ClientCertRequest
  location: class CordovaClientCertRequest
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemWebChromeClient.java:251: error: cannot find symbol

    public boolean onShowFileChooser(WebView webView, final ValueCallback<Uri[]>
 filePathsCallback, final WebChromeClient.FileChooserParams fileChooserParams) {


                                         ^
  symbol:   class FileChooserParams
  location: class WebChromeClient
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemWebViewClient.java:29: error: cannot find symbol
import android.webkit.ClientCertRequest;
                     ^
  symbol:   class ClientCertRequest
  location: package android.webkit
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemWebViewClient.java:116: error: cannot find symbol
    public void onReceivedClientCertRequest (WebView view, ClientCertRequest req
uest)
                                                           ^
  symbol:   class ClientCertRequest
  location: class SystemWebViewClient
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemWebChromeClient.java:249: error: cannot find symbol

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
                                  ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemCookieManager.java:37: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                                                        ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemCookieManager.java:38: error: cannot find symbol
            cookieManager.setAcceptThirdPartyCookies(webView, true);
                         ^
  symbol:   method setAcceptThirdPartyCookies(WebView,boolean)
  location: variable cookieManager of type CookieManager
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemCookieManager.java:59: error: cannot find symbol
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                                                        ^
  symbol:   variable LOLLIPOP
  location: class VERSION_CODES
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemCookieManager.java:60: error: cannot find symbol
            cookieManager.flush();
                         ^
  symbol:   method flush()
  location: variable cookieManager of type CookieManager
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemWebChromeClient.java:257: error: cannot find symbol

                    Uri[] result = WebChromeClient.FileChooserParams.parseResult
(resultCode, intent);
                                                  ^
  symbol:   variable FileChooserParams
  location: class WebChromeClient
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemWebChromeClient.java:250: error: method does not ov
erride or implement a method from a supertype
    @Override
    ^
C:\Users\Pratik\Documents\routeplannerfront\platforms\android\CordovaLib\src\org
\apache\cordova\engine\SystemWebViewClient.java:114: error: method does not over
ride or implement a method from a supertype
    @Override
    ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
14 errors
:CordovaLib:compileDebugJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib: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: 6.446 secs

1 个答案:

答案 0 :(得分:3)

我使用的是cordova 5.0.0

将其升级到5.1.1 npm update -g cordova&amp;然后使用

从项目中删除android

cordova platform remove android

然后再添加android

cordova platform add android

工作得很好。与此同时,我还安装了API22,因此其中一个或两个都负责解决这个问题。