天天看點

cordova項目添加插件出錯CordovaError: Could not determine package name from output

今天自定義了一個插件,在cordova項目添加插件時,出現了如下錯誤:

~/Desktop/Cordova/MyCordovaCamera$ cordova plugin add /home/kyun/Desktop/Cordova/CSCamera
{ CordovaError: Could not determine package name from output:

    at getTargetPackageSpecFromNpmInstallOutput (/usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/index.js:104:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
  name: 'CordovaError',
  message: 'Could not determine package name from output:\n',
  code: 0,
  context: undefined }      

出現錯誤的原因是plugin.xml配置java實作類時出錯:

<source-file src="src/android/CSCamera.java" target-dir="src/com/cs/camera/CSCamera" />      
<source-file src="src/android/CSCamera.java" target-dir="src/com/cs/camera" />