我目前正在尝试使用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 level 15.
答案 0 :(得分:4)
您需要使用API级别16进行构建,这样您才不会收到编译错误。 WebSettings.setAllowUniversalAccessFromFileURLs()方法是在API级别16中引入的。