cordova platform add android gives the error: “Error: The provided path is not an Android project.”

后端 未结 7 1278
一个人的身影
一个人的身影 2021-02-02 13:24

When I run the command, I get the error:

C:\\Users\\me\\adtworkspace\\project1>cordova platform add android [Error: The provided path \"C:\\Users\\me\

相关标签:
7条回答
  • 2021-02-02 14:06

    If you were to do a "cordova -d platform add android", you'll probably see that it is because a prior error happened due to "There is no script engine for file extension ".js"".

    Windows associated .js files with some other editors, so you have to disassociate this by typing:

    assoc .js=JSFILE

    After doing this, just run the add platform ("cordova platform add android") command again and it should work fine.

    0 讨论(0)
  • 2021-02-02 14:07

    Delete C:/users/yourusername/.cordova and run command again, files are propably corrupted, it fixed this issue for me

    0 讨论(0)
  • 2021-02-02 14:08

    Yes it's indeed a Cordova Metadata issue. So Krystofs' answer is correct. Where: The "right thing" to do is, to give a

    # cordova platform rm <platform>

    command :) Then - afterwards - another adding of the plaform shall sort the issue

    0 讨论(0)
  • 2021-02-02 14:08

    This is happening when you missing some files in your android platform folder in your cordova project.

    Same thing can happen with the windows projects as well.

    Visual Studio or Cordova engine has the capability of creating platform directories even if you delete them. But in this case the folder was there and it had some files in it. So the best solutions for this issue is trying one of these steps.

    Clean your project. ( Visual Studio ) Rebuild your project ( Visual Studio ) Delete platform directory that you have the issue and build the project.

    0 讨论(0)
  • 2021-02-02 14:21

    I had the same problem which I solved using the -d flag to show debug output

    cordova -d platform add android
    

    My debug output showed that I need to set a JAVA_HOME environment variable and then I needed to add JAVA and ANT to the path.

    0 讨论(0)
  • 2021-02-02 14:22

    I have faced the same but building for iOS. I had an old build within the platforms folder. Try deleting it, then build again:

    phonegap build [ios/android]
    

    Hope this helps!

    0 讨论(0)
提交回复
热议问题