Sunday, November 20, 2016

The command "platforms\android\cordova\clean.bat" exited with code 2. - Visual Studio 2015 - Cordova Apps


I had to deal with this error for months and finally I came up with some sort findings about the root of this error. In my experience there are few possible cases.

If you see this error on your visual studio errors window this is the check list to follow.

Case 1 : Temporary caching  issues in visual studio.

  1. Try to right click the project and rebuild. 
  2. If you cant rebuild the project restart visual studio. Then try again.
  3. If your project is building successfully that means its a temporary caching  problem.

Case 2 : System variables of visual studio not up to date.
  1. Go to tools >> options >>> Tools For Apache Cordova >>> Environment Variable Overrides .
  2. Check all the paths  for your environment variables are correct. If not please apply the correct path.
  3. And try to rebuild the project.

Case 3 : Android SDK is not up to-date.


  1. First delete the andoird folder in platforms folder. 
  2. Try to build your project.
  3. Now you will see more details about the error.
  4. So install or update any component of sdk that has any errors in visual studio error window.


Follow these steps by the above order. That will save you lot of time. 

Tuesday, November 15, 2016

Visual Studio 2015 Cordova Remotebuild failed Error: 65

After thing for moths I came up with a radical solution for this problem. When you are trying to build and deploy your cordova app on apple devices you are communicating through lot of third party tools and interfaces. All I did was I reduce number of layers that I'm communicating to deploy on a apple device.

I'm not going to describe basics of cordova , mac and vs 2015  as I assume you already have better knowledge of   these three environment.

1. Install xcode latest version on your mac.
2. Install apache cordova on your mac. You can find more details from apache cordova documentation.

https://cordova.apache.org/docs/en/latest/guide/platforms/osx/ 

3. Add platform ios for your project.
4. Add all requires plugin to your project.
5. Build your project for iOS.


This is a sample script I used for creating a cordova project on mac.


echo "CREATING CORDOVA PROJECT";
echo " ******** ";
echo "";

cd PATH;
cordova create ProjectName NameSpace ProjectTitile;
cd pericorp;
cordova platform add ios;
cordova build ios;


echo "INSTALLING REQUIRED PLUGINS";
echo " ******** ";
echo "";


cordova plugin add cordova-plugin-camera;
cordova plugin add cordova-plugin-compat;
cordova plugin add cordova-plugin-device;
cordova plugin add cordova-plugin-dialogs;
cordova plugin add cordova-plugin-file;
cordova plugin add cordova-plugin-file-transfer;
cordova plugin add cordova-plugin-geolocation;
cordova plugin add cordova-plugin-network-information;
cordova plugin add cordova-plugin-whitelist;
cordova plugin add cordova-sqlite-legacy;


echo "INSTALLED PLUGINS";
echo " ******** ";
echo "";


cordova plugin ls;

echo "Cordova Project Created!";
echo " ******** ";
echo "";


6. Now this will create an xcode project in /Platforms/ios/ folder.
7. Now you can build and deploy this as a normal xcode project.
8. All you have to do is replace content of your www folder and  build the project for iOS.


Notes
* Close xcode before building the project from the terminal.
* Never touch the www inside the platform folder it will be creating automatically when you building the cordova project.


If you have any questions please comment bellow. I'm happy to help if I can.