Home » Android » How to compile cordova project from visual studio (Hybrid App) to android / ios apk

How to compile cordova project from visual studio (Hybrid App) to android / ios apk

Posted by: admin June 15, 2020 Leave a comment

Questions:

I try to compile my Cordova Hybrid App from visual studio to apk file

  1. After I deploy the project to Android / iOS the project bin folder still empty.
  2. I try to upload the “www” folder to build.phonegap.com but I get error.
  3. What is the best and correct way to compile the project (HTML, CSS, and JS) to APK for Android and IOS?

Thanks,
Tom

Update:

I try to build from the visual studio

this is my Project folder
enter image description here

When I try to build project from the visual studio on “Device” mode I get this error

enter image description here

How to&Answers:

1- If you have used Ripple simulator as the target, nothing will be generated in the bin folder. You need to switch the build configuration to “device” in order for the binaries to be generated

2 – The www folder that is generated by the Visual Studio template has nothing special and you shouldn’t have issues with PhoneGap Build. If you have errors they are coming from your JS code itself

3 – To build the binaries for Android using the Multi-Device Hybrid extension for Visual Studio, you should be good by simply switching the build configuration to “device” instead of Ripple simulator. For iOS you need to use the Remote Build and Simulation Agent for iOS (which require have a Mac as the iOS tools are NOT available for Windows and you cannot generate the iOS binary directly on your Windows machine. Otherwise, you can consider using PhoneGap Build service

Answer:

From the image the error looks to be similar to the one I was getting about my device not being recognized/found.

This answer explains how to get the APK directly just by setting the solution to Release, and only Building the project rather trying to do a full deploy to a device. It pretty much is the same answer as mentioned in point 3 above, just tested on a PhoneGap App solution.