简体   繁体   中英

Cannot find symbol ClientCertRequest on CordovaLib compilation from cordova-android

I am currently building a PhoneGap app, with the following tools versions:

  • npm@2.5.1
  • cordova@3.6.0-0.2.9
  • cordova-android@3.6.0


In order to install a plugin which requires cordova-android v4+, I tried to install:

  • cordova@5.1.1
  • cordova-android@4.0.2


However, the cordova build command doesn't work anymore. Here are the first lines referencing to compilation errors:

Running: /Users/Pierre/Documents/project/platforms/android/gradlew cdvBuildDebug -b /Users/Pierre/Documents/project/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
/Users/Pierre/Documents/project/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
/Users/Pierre/Documents/project/platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:32: error: cannot find symbol
    private final ClientCertRequest request;
                  ^
  symbol:   class ClientCertRequest
  location: class CordovaClientCertRequest


From what I understand, the ClientCertRequest symbol has been introduced by the Android API level 21 , and my cordova build is trying to compile using an older level.

I tried to force the use of the API level 21.

The file /Users/Pierre/Documents/project/platforms/android/CordovaLib/project.properties contains the following:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.

# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-19
apk-configurations=
renderscript.opt.level=O0
android.library=true

So I tried to create a sibling file ant.properties containing:

target=android-21

but it doesn't change anything.

I also tried a bunch of other modifications which would be too long to describe here, but everything ends up to be overwritten.


Here is a screenshot of the Android tools installed on my system:在此处输入图片说明

What am I missing?

So it looks like it is still building with target=android-19 . Did you changed the AndroidManifest.xml to the required 21 version?

Android Min SDK Version vs. Target SDK Version

http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM