我是使用cordova的新手,我已经创建了项目
$cordova create helloworld
$cordova platform add android
我将项目属性target=android-22
更改为target=android-19
上的C:\android_project\helloworld\platforms\android\project.properties
以及C:\android_project\helloworld\platforms\android\CordovaLib\project.properties
然后我尝试在模拟器上运行但得到此错误:
c:\android_project\helloworld>cordova emulate --target=android_19 android
Running command: cmd "/s /c "c:\android_project\helloworld\platforms\android\cor
dova\run.bat""
ANDROID_HOME=C:\cordova\android\android-sdk-windows
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_60
WARNING : No target specified, deploying to emulator
Running: c:\android_project\helloworld\platforms\android\gradlew cdvBuildDebug -
b c:\android_project\helloworld\platforms\android\build.gradle -PcdvBuildArch=x8
6 -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 FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':CordovaLib:processDebugReso
urces'.
> Directory 'C:\android_project\helloworld\platforms\android\CordovaLib\build\in
termediates\bundles\debug\res' specified for property 'resDir' does not exist.
* 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.375 secs
c:\android_project\helloworld\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "c:\android_project\helloworld\pl
atforms\android\gradlew cdvBuildDebug -b c:\android_project\helloworld\platforms
\android\build.gradle -PcdvBuildArch=x86 -Dorg.gradle.daemon=true"
ERROR running one or more of the platforms: Error: cmd: Command failed with exit
code 1
You may not have the required environment or OS to run this project
我错过了什么吗?我用Google搜索了几个小时,但似乎无法找到解决方案。
答案 0 :(得分:1)
如果这有助于其他任何人...... 我决定通过创建
来解决这个问题android/CordovaLib/build/intermediates/bundles/debug/res
错误中提到的目录 - 只是空的。
然后我可以继续解决这个错误。
答案 1 :(得分:0)
某些Cordova Java文件需要api 21或更高版本。当您想要更改目标时,可以使用android manifest xml文件。