apache cordova in visual studio 2015/2017 does not build

528 views Asked by At

when include the cordova plugin media capture it throws this exception: C:........\BlankCordovaApp2\BlankCordovaApp2\platforms\android\src\org\apache\cordova\mediacapture\Capture.java:33: error: package org.apache.cordova.file does not exist BlankCordovaApp2 1
Error import org.apache.cordova.file.FileUtils; BlankCordovaApp2 1

below are the plugin included:

 <plugin name="cordova-plugin-device" spec="~1.1.7" />
  <plugin name="cordova-plugin-media-capture" spec="~1.4.3" />
  <plugin name="cordova-plugin-camera" spec="~2.4.1" />
  <plugin name="cordova-plugin-file" spec="~5.0.0" />
  <plugin name="cordova-plugin-file-transfer" spec="~1.7.0" />

the cordova version is <vs:toolsetVersion>6.3.1</vs:toolsetVersion>

I am not sure why it still cannot find the File class even though the file and file transfer is already included. the same error appear when both file and file transfer is not included. the error shows up when media capture is included as the project can build without the media capture plugin. BUT media capture plugin is needed for the bardcode scanner plugin base from this tutorial: http://www.c-sharpcorner.com/UploadFile/020f8f/barcode-scanner-cross-platform-app-using-cordova-in-visual-s/

EDIT:

I tried to build the plugins one by one and turns out that the File Transfer plugin itself has problem because it cannot find FileTransfer class file, even though it self is included.

1

There are 1 answers

0
BigFoppa On

Have you tried with a later version of Cordova? You find the version history at the Cordova Blog. Try installing the [email protected] version globally from the command line:

  npm install -g [email protected]

Later versions will give you other problems/quirks.

And in vs change config.xml to use the globally installed cordova version.

Your plugins have a mix of older and newer version numbers. Try removing and reinstalling them after the cordova upgrade without specifying version numbers. From the command line:

cordova plugin rm cordova-plugin-file
cordova plugin rm cordova-plugin-file-transfer
cordova plugin add cordova-plugin-file
cordova plugin add cordova-plugin-file-transfer

/Big