1

My problem

I have been using the Tools for Apache Cordova template in visual studio to build an app it has been working for me for like two months no problem at all but then suddenly yesterday after I built it like 6 times it just stopped working.

In VS you get some really bad build errors that don't tell you much about the problem like:

Severity Code Description Project File Line Source Error C:\Konstruktion\MyFirstApp\MyFirstApp\MyFirstApp\platforms\android\cordova\build.bat: Command failed with exit code 1 MyFirstApp C:\Konstruktion\MyFirstApp\MyFirstApp\MyFirstApp\ERROR building one of the platforms 1 Build

and

Severity Code Description Project File Line Source Error C:\Konstruktion\MyFirstApp\MyFirstApp\MyFirstApp\platforms\android\cordova\build.bat: Command failed with exit code 1 MyFirstApp C:\Konstruktion\MyFirstApp\MyFirstApp\MyFirstApp\MDAVSCLI 1 Build

So I did try to build it without the help of visual studio with just the CMD commands this was the error I then got:

[Error: Please install Android target: "android-21"]
Hint: Open the SDK manager by running C:\Users\username\AppData\Local\Anndroid\sdk\tools\android.BAT
You will require:
1. "SDK Platfrom" for android-21
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools (latest)]
Error: cmd: Command failed with exit code 2
at ChildProsses.whenDone (C:\Users\myUsername\AppData\Roming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at mybyClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

(This is handwritten sens I don't know how copy to the entire output from cmd if you know I can update the question).

Things I have tried so far

  1. re-install the asked tools and sdk platforms via SDK manager
  2. re-install the entire sdk
  3. this Stack Overflow question

What will I try today?

  1. The awesome solutions readers can come up with!
  2. Install everything on a different computer and try there
  3. Try it on windows-10 (like that will help)

Images

From the sdk where it says I have installed android-21

Community
  • 1
  • 1
Kladfizk
  • 99
  • 1
  • 17
  • found a possible solution [got 2 sdk installed on 2 different paths](http://stackoverflow.com/questions/31540722/error-please-install-android-target-android-22-when-sdk-manager-shows-it-is?rq=1) – Kladfizk Jul 29 '15 at 10:02
  • Now i have uninstalled both sdks and when i did that i lost all binding in the environment variable > system variable path so after re installing it i had to add then manually to the variable, ill post how to do this if it solves my problem – Kladfizk Jul 29 '15 at 13:18
  • No that did not work but now i have a new error `You may not have the required environment or OS to build this project Command failed with exit code 1` – Kladfizk Jul 29 '15 at 14:51
  • OK now i can build new fresh projects at least so now i can move my code over to the new project and try to rebuild it there well at i hope so – Kladfizk Jul 29 '15 at 15:30
  • It's ALIVE!!! No idea why and how it got messed up in the first place but i can keep working on it at least i guess ill still have the questions open but ill mark it with a workaround tag or smothing – Kladfizk Jul 29 '15 at 15:38
  • (I've reduced the amount of chatty content in this question, and rolled back the answer edit - answers belong below, which you now have done - thanks). – halfer Aug 01 '15 at 17:00

1 Answers1

0

I found why the problem appears. This is a problem that only affects user how uses Cordova tools for Visual Studio! (I think).

If you start a build and then cancel it if you have device or emulator selected it will corrupt some files in the debug folder:

C:\Konstruktion\myApp\myApp\myApp\bin\Android\Debug

or where you have put it.

If you don't know where it is just right click the project name in the solution explorer and then click "Open path in File Explorer"

Navigate to the debug folder and delete it's contents, build again and it should work again.

bin\Android\Debug
halfer
  • 19,824
  • 17
  • 99
  • 186
Kladfizk
  • 99
  • 1
  • 17