我目前正在尝试使用cordova(phonegap)进入移动设备的跨平台开发.
现在,我正在尝试构建cordova.jar-所以我刚开始.
当我运行android update project -p时. -t android-15在我的框架目录中,我得到输出:
E:\eclipse\cordova-android-master\framework>android update project -p . -t android-15
Updated project.properties
Updated local.properties
build.xml: Found version-tag: custom. File will not be updated.
Updated file E:\eclipse\cordova-android-master\framework\proguard-project.txt
It seems that there are sub-projects. If you want to update them
please use the --subprojects parameter.
然后,在我在框架目录中运行命令ant jar的步骤中,得到输出:
Buildfile: E:\eclipse\cordova-android-master\framework\build.xml
-check-env:
[checkenv] Android SDK Tools Revision 21
[checkenv] Installed at E:\eclipse\android-sdk-windows
-setup:
[echo] Project Name: Cordova
[gettype] Project Type: Android Library
-pre-clean:
clean:
[delete] Deleting directory E:\eclipse\cordova-android-master\framework\bin
[delete] Deleting directory E:\eclipse\cordova-android-master\framework\gen
[getlibpath] Library dependencies:
[getlibpath] No Libraries
[subant] No sub-builds to iterate on
build-javascript:
-build-setup:
[echo] Resolving Build Target for Cordova...
[gettarget] Project Target: Android 4.0.3
[gettarget] API level: 15
[echo] ----------
[echo] Creating output directories if needed...
[mkdir] Created dir: E:\eclipse\cordova-android-master\framework\bin
[mkdir] Created dir: E:\eclipse\cordova-android-master\framework\bin\res
[mkdir] Created dir: E:\eclipse\cordova-android-master\framework\gen
[mkdir] Created dir: E:\eclipse\cordova-android-master\framework\bin\classes
[mkdir] Created dir: E:\eclipse\cordova-android-master\framework\bin\dexedLibs
[echo] ----------
[echo] Resolving Dependencies for Cordova...
[dependency] Ordered libraries:
[dependency]
[dependency] ------------------
[dependency] API<=15: Adding annotations.jar to the classpath.
[echo] ----------
[echo] Building Libraries with '${build.target}'...
[subant] No sub-builds to iterate on
-pre-build:
-code-gen:
[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...
[renderscript] No RenderScript files to compile.
[echo] ----------
[echo] Handling Resources...
[aapt] Generating resource IDs...
[echo] ----------
[echo] Handling BuildConfig class...
[buildconfig] Generating BuildConfig class.
-pre-compile:
-compile:
[javac] Compiling 53 source files to E:\eclipse\cordova-android-master\framework\bin\classes
[javac] E:\eclipse\cordova-android-master\framework\src\org\apache\cordova\CordovaWebView.java:900: error: cannot find symbol
[javac] settings.setAllowUniversalAccessFromFileURLs(true);
[javac] ^
[javac] symbol: method setAllowUniversalAccessFromFileURLs(boolean)
[javac] location: variable settings of type WebSettings
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error
有谁知道我在做什么错?
正如自述文件所述,common-codec-1.6.jar位于lib文件夹中.
已安装android api 15级.
解决方法:
您需要使用API级别16进行构建,以免出现编译错误. API级别16中引入了WebSettings.setAllowUniversalAccessFromFileURLs()方法.