我2个月后开始使用cordova Android编程 . 一切都很好主要是现在没有工作的相机 . 但上周一些我的项目目录如何被删除,我重新安装所有插件的cordova和编译项目,但现在它显示错误'非法参数异常'在相机上点击令人惊讶的事情是我没有更改单行代码,它也正常工作在其他开发者机器上 .
cordova插件添加了使用相机插件安装的cordova-plugin-camera命令 .
camera_app.js文件
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 onPhotoURISuccess(imageURI) {
// largeImage.src = imageURI;
console.log(imageURI);
console.log(document_type);
}
function getPhoto(docType) {
// Retrieve image file location from specified source
document_type = docType
$('.docError').hide();
navigator.camera.getPicture(onPhotoURISuccess, onFail, {
quality: 50,
destinationType: destinationType.FILE_URI
});
}
$('#file1').click(function() {
console.log('On camera click');
getPhoto("addressProof");
});
我试图调试代码终于发现它是由于提供者路径 - java.lang.IllegalArgumentException: Missing android.support.FILE_PROVIDER_PATHS meta-data
但是我已经在Android xml文件中添加了提供者路径元数据,因为当你添加cordova插件时会自动添加它 .
cordova插件 -
cordova-plugin-app-version 0.1.9“AppVersion”cordova-plugin-camera 2.4.1“Camera”cordova-plugin-compat 1.1.0“Compat”cordova-plugin-whitelist 1.3.2“Whitelist”cordova-sqlite-存储1.4.9“Cordova sqlite存储插件”ionic-plugin-keyboard 2.2.1“键盘”
科尔多瓦平台 -
安装平台:android 6.2.3可用平台:blackberry10~3.8.0(不建议使用)浏览器~4.1.0 webos~3.7.0 windows~5.0.0
NPM版本 - {npm:'3.10.3',ares:'1.10.1-DEV',http_parser:'2.7.0',icu:'57 .1',模块:'48',节点:'6.4.0', openssl:'1.0.2h',uv:'1.9.1',v8:'5.0.71.60',zlib:'1.2.8'}