When it comes to developing Apache Cordova mobile apps using Microsoft Visual Studio 2017, you may encounter several issues that can hinder your progress. In this article, we'll explore some of the most common problems developers face when working with Visual Studio 2017 and Apache Cordova.
Stuck with Outdated Cordova Toolset
One of the primary concerns is the outdated Cordova toolset provided by Visual Studio 2017. The toolset has been stuck at version 6.3.1 since VS2017 was released, leaving you with older versions of cordova-android and cordova-ios tools. While you can use the globally installed CLI version like Cordova 7.1.0, this approach comes with its own set of challenges.
For instance, when using Cordova 7.1.0 and cordova-android 6.3.0, you might encounter errors related to the Android platform. As you increase the cordova-android version, Visual Studio 2017 may report Deploy failed on the status bar, even though deploy to device and emulator works fine.
Inconsistent Cordova Toolset Selection
Another issue is that the selected Cordova toolset is not saved. By default, Visual Studio 2017 creates new Apache Cordova projects with its own Cordova 6.3.1 toolset. If you change it to use the globally installed Cordova version, this setting is forgotten next time you open the project.
To overcome this issue, manually edit config.xml in View Code mode and locate the vs:toolsetVersion tag. Replace the outdated version number with your globally installed version number (e.g., 9.0.0). This ensures that your globally installed Cordova version is used for all build operations.
Android SDK Compatibility Issues
When you change the Cordova CLI and cordova-android version, you may encounter an error related to the Android SDK. Cordova 7.1.0 requires the Android SDK 26 to compile, so you must set the ANDROID_HOME setting from Visual Studio 2017 to your externally installed Android SDK.
Unfortunately, changing the ANDROID_HOME path in the Tools for Apache Cordova settings may cause the Deploy to Emulator option to disappear, replaced by Install Google Android emulators. To deploy to emulator manually using the cordova emulate command: cordova run --emulator. However, you won't be able to use Visual Studio's built-in debugging tools.
Conclusion
Swift app development with Apache Cordova and Visual Studio 2017 can be challenging, but understanding these common issues will help you overcome them. By updating your Cordova toolset, managing your Android SDK versions, and using the cordova emulate command, you'll be able to successfully develop and deploy your mobile apps.
Target keyword: swift app development