<commit_before><properties pageTitle="General Cordova tips and workarounds"
  description="This is an article on bower tutorial"
  services=""
  documentationCenter=""
  authors="kirupa" />
  <tags ms.technology="cordova" ms.prod="visual-studio-dev14"
     ms.service="na"
     ms.devlang="javascript"
     ms.topic="article"
     ms.tgt_pltfrm="mobile-multiple"
     ms.workload="na"
     ms.date="09/10/2015"
     ms.author="kirupac"/>

#General Cordova tips and workarounds
This document covers tips, tricks, and known workarounds for general issues with Cordova or Tools for Apache Cordova.

<a name="firsttime"></a>
##Resolve build and deployment errors when you build for the first time

Try these steps.

1. Wait for the build to complete.

    When building for the first time, Visual Studio downloads and installs Cordova dependencies. The first build can take considerably longer than normal to complete.

    Similarly, when you first start an emulator, the emulator may take considerable time to load (leave the emulator open between app restarts to avoid this issue).

2. Check your Visual Studio notifications (upper right) to see if you need any updates to Visual Studio or to Visual Studio Tools for Apache Cordova. Install any updates and retry.

    ![Visual Studio notifications](media/tips-and-workarounds-general-readme/vs-notifications.png)

3. In Visual Studio, run the Dependency Checker by choosing **Tools**, **Options**, **Tools for Apache Cordova**, and selecting **Run Dependency Checker**. Investigate any resulting messages.
4. Check the Output window and the Error List window for build error information and guidance.

    ![Visual Studio notifications](media/tips-and-workarounds-general-readme/output-window.png)

    If you're not sure what to do next, see the next section on resolving general build and deployment errors.

<a name="general"></a>
##Resolve general build and deployment errors

Try these steps if you have trouble deploying to emulators or devices.

1. Running on a device? Make sure that your device is enabled for development. Instructions to do this are different for each platform.
    * For Android, see [Android](../android/tips-and-workarounds-android-readme.md). For iOS, see [iOS guide](../../getting-started/ios-guide.md). (iOS devices need a provisioning profile.) For Windows Phone, see [this article](../../develop-apps/run-app-windows-phone.md). For Windows 10, Visual Studio will prompt you to enable the device.
2. If you are running on a device and the app is already installed, uninstall the app and try again.
4. Delete the project's platforms/*platform* folder (such as platforms/android) and the plugins folder from the project and try again (navigating to the root of your project folder in a command window and typing the command  `cordova platforms remove android` also removes the platform).

    ![The platforms and plugins folders](media/tips-and-workarounds-general-readme/platforms-folder.png)

    If the issue only occurs with a particular plugin, you may have an incompatibility with the plugin or between your Cordova version and the plugin version. See other sections in this article and see [Change the CLI version](../develop-apps/change-cli-version.md).

3. If you haven't done it already, [check your update notifications and run the dependency checker](#firsttime).
4. If you are not using a new blank project already, create an empty project using the Blank App template (you can find it under **JavaScript**, **Apache Cordova Apps** when creating a new project) and see if you get the same error when you build.
    If the Blank App template runs fine, the issue may be specific to your project.
5. Try to run your app against a different platform or emulator and see if that is successful.

    Here are a few suggested platforms for testing:
    * Try running against Android and select **Ripple - Nexus (Galaxy)** (Chrome required)
    * Open the configuration designer (config.xml), the **Windows** tab, select your OS version, and then try running against **Windows-x64** or **Windows-x86** and select **Local Machine**.

    If the issue is only on the Android platform, see [Android](../android/tips-and-workarounds-android-readme.md). If the issue is only on iOS, see the troubleshooting tips in the [iOS setup guide](../../getting-started/ios-guide.md). If the issue is only on Windows, see [Windows](../windows/tips-and-workarounds-windows-readme.md).

6. If you see a message that you are unable to start debugging, see [this workaround](#debugging).
7. Try [clearing the cache](../getting-started/configure-vs-tools-apache-cordova.md#vstac) from **Tools**, **Options**, **Tools for Apache Cordova** and re-installing vs-tac.

<a name="debugging"></a>
##Unable to start debugging

If you get a message in Visual Studio that says you can't start debugging your app, try these steps.

1. Close all instances of Visual Studio.
2. Open this folder:

    C:\Users\username\%appdata%\Local\Microsoft\Phone Tools
3. Rename the CoreCon folder to any other name (CoreCon will get recreated when you rebuild).
4. Restart Visual Studio and try again.

<a name="missingexclude"></a>
##Building a Cordova project from source control results in a successful build, but with Cordova plugin APIs not returning results when the app is run
Due to a bug in the VS templates in VS 2015 RC, four json files that can cause issues if they are added to source control, are missing from the default source code exclusion list:

- plugins/android.json
- plugins/ios.json
- plugins/windows.json
- plugins/remote_ios.json
- plugins/wp8.json.

Adding these files to source control can result in a build that appears to succeed, but is missing plugin native code. They should only be included if the "platforms" folder is also checked in, which is not recommended.

A sign that you are encountering this issue is that the build appears to succeed and the app starts up properly, but the Cordova plugin APIs does not appear to function, and no error appears in the JavaScript console. On further inspection, when you debug an Android version of your app, you might see an exception similar to the following in the **Output Window**:

```
W/System.err( 1425): java.lang.ClassNotFoundException: org.apache.cordova.camera.CameraLauncher
W/System.err( 1425):  at java.lang.Class.classForName(Native Method)<commit_msg>additions to troubleshooting<commit_after><properties pageTitle="General Cordova tips and workarounds"
  description="This is an article on bower tutorial"
  services=""
  documentationCenter=""
  authors="kirupa" />
  <tags ms.technology="cordova" ms.prod="visual-studio-dev14"
     ms.service="na"
     ms.devlang="javascript"
     ms.topic="article"
     ms.tgt_pltfrm="mobile-multiple"
     ms.workload="na"
     ms.date="09/10/2015"
     ms.author="kirupac"/>

#General Cordova tips and workarounds
This document covers tips, tricks, and known workarounds for general issues with Cordova or Tools for Apache Cordova.

<a name="firsttime"></a>
##Resolve build and deployment errors when you build for the first time

Try these steps.

1. Wait for the build to complete.

    When building for the first time, Visual Studio downloads and installs Cordova dependencies. The first build can take considerably longer than normal to complete.

    Similarly, when you first start an emulator, the emulator may take considerable time to load (leave the emulator open between app restarts to avoid this issue).

2. Check your Visual Studio notifications (upper right) to see if you need any updates to Visual Studio or to Visual Studio Tools for Apache Cordova. Install any updates and retry.

    ![Visual Studio notifications](media/tips-and-workarounds-general-readme/vs-notifications.png)

3. In Visual Studio, run the Dependency Checker by choosing **Tools**, **Options**, **Tools for Apache Cordova**, and selecting **Run Dependency Checker**. Investigate any resulting messages.
4. Check the Output window and the Error List window for build error information and guidance.

    ![Visual Studio notifications](media/tips-and-workarounds-general-readme/output-window.png)

    If you're not sure what to do next, see the next section on resolving general build and deployment errors.

<a name="general"></a>
##Resolve general build and deployment errors

Try these steps if you have trouble deploying to emulators or devices.

1. Running on a device? Make sure that your device is enabled for development. Instructions to do this are different for each platform.
    * For Android, see [Android](../android/tips-and-workarounds-android-readme.md). For iOS, see [iOS guide](../../getting-started/ios-guide.md). (iOS devices need a provisioning profile.) For Windows Phone, see [this article](../../develop-apps/run-app-windows-phone.md). For Windows 10, Visual Studio will prompt you to enable the device.
2. If you are running on a device and the app is already installed, uninstall the app and try again.
4. Delete the project's platforms/*platform* folder (such as platforms/android) and the plugins folder from the project and try again (navigating to the root of your project folder in a command window and typing the command  `cordova platforms remove android` also removes the platform).

    ![The platforms and plugins folders](media/tips-and-workarounds-general-readme/platforms-folder.png)

    If the issue only occurs with a particular plugin, you may have an incompatibility with the plugin or between your Cordova version and the plugin version. See other sections in this article and see [Change the CLI version](../develop-apps/change-cli-version.md).

3. If you haven't done it already, [check your update notifications and run the dependency checker](#firsttime).
4. If you are not using a new blank project already, create an empty project using the Blank App template (you can find it under **JavaScript**, **Apache Cordova Apps** when creating a new project) and see if you get the same error when you build.
    If the Blank App template runs fine, the issue may be specific to your project.
5. Try to run your app against a different platform or emulator and see if that is successful.

    Here are a few suggested platforms for testing:
    * Try running against Android and select **Ripple - Nexus (Galaxy)** (Chrome required)
    * Open the configuration designer (config.xml), the **Windows** tab, select your OS version, and then try running against **Windows-x64** or **Windows-x86** and select **Local Machine**.

    If the issue is only on the Android platform, see [Android](../android/tips-and-workarounds-android-readme.md). If the issue is only on iOS, see the troubleshooting tips in the [iOS setup guide](../../getting-started/ios-guide.md). If the issue is only on Windows, see [Windows](../windows/tips-and-workarounds-windows-readme.md).

6. If you see a message that you are unable to start debugging or if no emulators or devices are visible as debug targets, see [this workaround](#debugging).
7. Try [clearing the cache](../getting-started/configure-vs-tools-apache-cordova.md#vstac) from **Tools**, **Options**, **Tools for Apache Cordova** and re-installing vs-tac.

<a name="debugging"></a>
##Unable to start debugging

If you get a message in Visual Studio that says you can't start debugging your app, try these steps. Also, try these steps if no emulators or devices are listed in the debug target dropdown list.

1. Close all instances of Visual Studio.
2. Open this folder:

    C:\Users\username\%appdata%\Local\Microsoft\Phone Tools
3. Rename the CoreCon folder to any other name (CoreCon will get recreated when you rebuild).
4. Restart Visual Studio and try again.

<a name="missingexclude"></a>
##Building a Cordova project from source control results in a successful build, but with Cordova plugin APIs not returning results when the app is run
Due to a bug in the VS templates in VS 2015 RC, four json files that can cause issues if they are added to source control, are missing from the default source code exclusion list:

- plugins/android.json
- plugins/ios.json
- plugins/windows.json
- plugins/remote_ios.json
- plugins/wp8.json.

Adding these files to source control can result in a build that appears to succeed, but is missing plugin native code. They should only be included if the "platforms" folder is also checked in, which is not recommended.

A sign that you are encountering this issue is that the build appears to succeed and the app starts up properly, but the Cordova plugin APIs does not appear to function, and no error appears in the JavaScript console. On further inspection, when you debug an Android version of your app, you might see an exception similar to the following in the **Output Window**:

```
W/System.err( 1425): java.lang.ClassNotFoundException: org.apache.cordova.camera.CameraLauncher
W/System.err( 1425):  at java.lang.Class.classForName(Native Method)
{'fraction_non_alphanumeric': 0.08003089996137505, 'fraction_numerical': 0.006952491309385863, 'mean_word_length': 4.288398692810458, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5454139', 'n_tokens_mistral': 3444, 'n_tokens_neox': 3262, 'n_words': 1719}