简体   繁体   中英

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.

This is the error I'm getting while running cordova run android command.

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.

The original path is stored in some files in the platforms/android folder. (seen it at least in fileSnapshots.bin in the .gradle folder) when you add the android platform to your project.

First thing you can try is to run platforms\\android\\cordova\\clean.bat to see if it corrects your issue.

If it doesn't work I think the easiest would be to remove the android platform and re-add it. (be sure to save any files you may have modified in the platforms/android folder before you proceed!)

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)

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. 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.

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