Phone差距HTML5无法打开相机

Phone gap HTML5 unable to open the camera

在我添加的 config.xml 文件中

<plugin name="cordova-plugin-camera" /> <plugin name="cordova-plugin-media-capture"/>

在index.html文件中

<script type="text/javascript" charset="utf-8" src="cordova.js"></script> ... <button onclick="capturePhoto();">Capture Photo</button>

然后在Javascript标签

    <script>
    var pictureSource;   // picture source
    var destinationType; // sets the format of returned value

     // Wait for device API libraries to load
    document.addEventListener("deviceready",onDeviceReady,false);

     // device APIs are available
    function onDeviceReady() {
        pictureSource=navigator.camera.PictureSourceType;
        destinationType=navigator.camera.DestinationType;
    }

      // Called when a photo is successfully retrieved
    function onPhotoDataSuccess(imageData) {
      // Uncomment to view the base64-encoded image data
      alert(imageData);

      // Get image handle
      var smallImage = document.getElementById('smallImage');

      // Unhide image elements
      smallImage.style.display = 'block';

      // Show the captured photo
      // The inline CSS rules are used to resize the image
      smallImage.src = "data:image/jpeg;base64," + imageData;
    }

    function capturePhoto() {
        alert("I am here");
        navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
        destinationType: Camera.DestinationType.DATA_URL
        });
    }

    function onFail(message) {
        alert('Failed because: ' + message);
    }
</script>

单击按钮时我收到警报 'I am here',这意味着 html 按钮正在调用 capturePhoto() 函数。 而且我没有收到任何错误警报!

但是相机打不开!

我正在使用在线 https://build.phonegap.com/ 以获取 apk

我已经坚持了一段时间..有什么建议吗?

我通过使用 spec="2.0"

添加旧版本的 'cordova-plugin-camera' 解决了这个问题

<plugin name="cordova-plugin-camera" spec="2.0" />

并添加了

<feature name="Camera"> <param name="android-package" value="org.apache.cordova.CameraLauncher" /> </feature>

有谁知道与 cli-6.5.0 兼容的最新 'cordova-plugin-camera' 版本是什么?