简体   繁体   English

Cordova CLI android路径错误

[英]Cordova CLI android path error

I changed the directory structure E: to R:, but still in build.xml is picking the E:\\Adroid SDK\\... path, infact the ANDROID_HOME variable is correct R:\\Android SDK\\... but still. 我将目录结构E:更改为R :,但仍在build.xml中选择E:\\Adroid SDK\\...路径,实际上ANDROID_HOME变量是正确的R:\\Android SDK\\...但仍然。

This is the error I'm getting while running cordova run android command. 这是我在运行cordova run android命令时遇到的错误。

R:\Cordova\workshop>cordova run android
Running command: cmd "/s /c "R:\Cordova\workshop\platforms\android\cordova\run.b
at""
Buildfile: R:\Cordova\workshop\platforms\android\build.xml
BUILD FAILED
R:\Cordova\workshop\platforms\android\build.xml:90: Cannot find E:\Android SDK\android-sdk\tools\ant\build.xml imported from R:\Cordova\workshop\platforms\android\build.xml

Total time: 0 seconds

R:\Cordova\workshop\platforms\android\cordova\node_modules\q\q.js:126
                throw e;
                      ^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,R:\Cordova\workshop\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen 
ERROR running one or more of the platforms: Error: cmd: Command failed with exit
code 8
You may not have the required environment or OS to run this project

Any body have any idea why the old pah is still there and how to change it, it'll be helpfull. 任何人都知道为什么旧的pah仍然存在以及如何更改它,这将是有帮助的。

The original path is stored in some files in the platforms/android folder. 原始路径存储在platform / android文件夹中的某些文件中。 (seen it at least in fileSnapshots.bin in the .gradle folder) when you add the android platform to your project. (至少在.gradle文件夹的fileSnapshots.bin中看到),将android平台添加到项目中。

First thing you can try is to run platforms\\android\\cordova\\clean.bat to see if it corrects your issue. 您可以尝试的第一件事是运行platform \\ android \\ cordova \\ clean.bat以查看它是否可以解决您的问题。

If it doesn't work I think the easiest would be to remove the android platform and re-add it. 如果它不起作用,我认为最简单的方法是删除android平台并重新添加。 (be sure to save any files you may have modified in the platforms/android folder before you proceed!) (在继续之前,请确保将您可能已修改的所有文件保存在platform / android文件夹中!)

cordova platform remove android
cordova platform add android

(maybe add a version number with @versionnumber if you need to use a specific version or the android platform) (如果您需要使用特定版本或android平台,则可以使用@versionnumber添加版本号)

I sorted out by just replacing with only those java files, www and plugins folder which are different, but still using Gradle build.Trying to use Ant build. 我通过仅替换那些不同的java文件, wwwplugins文件夹进行了梳理,但仍使用Gradle build。试图使用Ant build。 Currently I'm back on track, no issue with compiling. 目前,我已回到正轨,编译没有问题。

I'm sure this will help you so that you can start development again. 我相信这会为您提供帮助,以便您可以重新开始开发。

But be careful while manipulating java files, by the way you get the errors you can be able to sort it, but still. 但是在处理java文件时要小心,通过得到错误的方式,您仍然可以对它进行排序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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