为cordova 4.1.1错误构建ANT jar文件

时间:2015-12-08 07:10:29

标签: java eclipse cordova ant

使用cordova 4.1.1源代码构建ANT jar文件时遇到问题。

这是我构建ANT时的命令行。

C:\package\framework>android update project -p . -t android-19
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Updated file C:\package\framework\proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.

C:\package\framework>android update project -p . -t android-19 --subprojects
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Updated file C:\package\framework\proguard-project.txt
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using project folder name 'bin'.
If you wish to change it, edit the first line of build.xml.
Added file C:\package\framework\bin\build.xml
Added file C:\package\framework\bin\proguard-project.txt

C:\package\framework>ant jar
Buildfile: C:\package\framework\build.xml

-pre-build:

-check-env:
 [checkenv] Android SDK Tools Revision 24.4.1
 [checkenv] Installed at C:\Android\adt-bundle-windows-x86_64-20140702\sdk

-setup:
     [echo] Project Name: Cordova
  [gettype] Project Type: Android Library

-build-setup:
[getbuildtools] Using latest Build Tools: 20.0.0
     [echo] Resolving Build Target for Cordova...
[gettarget] Project Target:   Android 4.4.2
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: C:\package\framework\bin\rsObj
    [mkdir] Created dir: C:\package\framework\bin\rsLibs
     [echo] ----------
     [echo] Resolving Dependencies for Cordova...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with '${build.target}'...
   [subant] No sub-builds to iterate on

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found new input file
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.

-pre-compile:

-compile:
    [javac] Compiling 36 source files to C:\package\framework\bin\classes
    [javac] C:\package\framework\src\org\apache\cordova\CordovaClientCertRequest
.java:25: error: cannot find symbol
    [javac] import android.webkit.ClientCertRequest;
    [javac]                      ^
    [javac]   symbol:   class ClientCertRequest
    [javac]   location: package android.webkit
    [javac] C:\package\framework\src\org\apache\cordova\CordovaClientCertRequest
.java:32: error: cannot find symbol
    [javac]     private final ClientCertRequest request;
    [javac]                   ^
    [javac]   symbol:   class ClientCertRequest
    [javac]   location: class CordovaClientCertRequest
    [javac] C:\package\framework\src\org\apache\cordova\CordovaClientCertRequest
.java:34: error: cannot find symbol
    [javac]     public CordovaClientCertRequest(ClientCertRequest request) {
    [javac]                                     ^
    [javac]   symbol:   class ClientCertRequest
    [javac]   location: class CordovaClientCertRequest
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:40: error: cannot find symbol
    [javac] import android.webkit.PermissionRequest;
    [javac]                      ^
    [javac]   symbol:   class PermissionRequest
    [javac]   location: package android.webkit
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:253: error: cannot find symbol
    [javac]     public boolean onShowFileChooser(WebView webView, final ValueCal
lback<Uri[]> filePathsCallback, final WebChromeClient.FileChooserParams fileChoo
serParams) {
    [javac]
                                                     ^
    [javac]   symbol:   class FileChooserParams
    [javac]   location: class WebChromeClient
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:273: error: cannot find symbol
    [javac]     public void onPermissionRequest(final PermissionRequest request)
 {
    [javac]                                           ^
    [javac]   symbol:   class PermissionRequest
    [javac]   location: class SystemWebChromeClient
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebViewClie
nt.java:29: error: cannot find symbol
    [javac] import android.webkit.ClientCertRequest;
    [javac]                      ^
    [javac]   symbol:   class ClientCertRequest
    [javac]   location: package android.webkit
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebViewClie
nt.java:116: error: cannot find symbol
    [javac]     public void onReceivedClientCertRequest (WebView view, ClientCer
tRequest request)
    [javac]                                                            ^
    [javac]   symbol:   class ClientCertRequest
    [javac]   location: class SystemWebViewClient
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:251: error: cannot find symbol
    [javac]     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    [javac]                                   ^
    [javac]   symbol:   variable LOLLIPOP
    [javac]   location: class VERSION_CODES
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:271: error: cannot find symbol
    [javac]     @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    [javac]                                   ^
    [javac]   symbol:   variable LOLLIPOP
    [javac]   location: class VERSION_CODES
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemCookieManag
er.java:37: error: cannot find symbol
    [javac]         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

    [javac]                                                         ^
    [javac]   symbol:   variable LOLLIPOP
    [javac]   location: class VERSION_CODES
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemCookieManag
er.java:38: error: cannot find symbol
    [javac]             cookieManager.setAcceptThirdPartyCookies(webView, true);

    [javac]                          ^
    [javac]   symbol:   method setAcceptThirdPartyCookies(WebView,boolean)
    [javac]   location: variable cookieManager of type CookieManager
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemCookieManag
er.java:59: error: cannot find symbol
    [javac]         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

    [javac]                                                         ^
    [javac]   symbol:   variable LOLLIPOP
    [javac]   location: class VERSION_CODES
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemCookieManag
er.java:60: error: cannot find symbol
    [javac]             cookieManager.flush();
    [javac]                          ^
    [javac]   symbol:   method flush()
    [javac]   location: variable cookieManager of type CookieManager
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:259: error: cannot find symbol
    [javac]                     Uri[] result = WebChromeClient.FileChooserParams
.parseResult(resultCode, intent);
    [javac]                                                   ^
    [javac]   symbol:   variable FileChooserParams
    [javac]   location: class WebChromeClient
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:252: error: method does not override or implement a method from a supe
rtype
    [javac]     @Override
    [javac]     ^
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebChromeCl
ient.java:272: error: method does not override or implement a method from a supe
rtype
    [javac]     @Override
    [javac]     ^
    [javac] C:\package\framework\src\org\apache\cordova\engine\SystemWebViewClie
nt.java:114: error: method does not override or implement a method from a supert
ype
    [javac]     @Override
    [javac]     ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] 18 errors

BUILD FAILED
C:\Android\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:716: The f
ollowing error occurred while executing this line:
C:\Android\adt-bundle-windows-x86_64-20140702\sdk\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.

总时间:1秒

我使用ANT 1.9.6,Cordova 4.1.1。 任何人都可以帮助我! 非常感谢。

1 个答案:

答案 0 :(得分:0)

我也有这个问题。上面的错误可以解决,将targetsdkversion更改为22.但是(有时)也不允许你使用ant构建apks。尝试使用gradle构建项目。