I started cordova Android programming 2 month back. Everything was fine mainly camera that is not working now. But last week some how my project directory got deleted and I reinstall all plugin of cordova and complied project but now its showing error 'illegal argument exception' on camera click surprising thing is i didn't change single line of code and it's also working properly on other developer machine.
cordova plugin add cordova-plugin-camera command used from camera plugin installation.
camera_app.js file
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");
});
I tried to debug code finally found it's due to provider path- java.lang.IllegalArgumentException: Missing android.support.FILE_PROVIDER_PATHS meta-data
but I have already added provider path meta data in Android xml file, as its automatically gets added when you add cordova plugin.
<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
</provider>
cordova plugin -
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-storage 1.4.9 "Cordova sqlite storage plugin" ionic-plugin-keyboard 2.2.1 "Keyboard"
cordova platform-
Installed platforms: android 6.2.3 Available platforms: blackberry10 ~3.8.0 (deprecated) browser ~4.1.0 webos ~3.7.0 windows ~5.0.0
NPM version- { npm: '3.10.3', ares: '1.10.1-DEV', http_parser: '2.7.0', icu: '57.1', modules: '48', node: '6.4.0', openssl: '1.0.2h', uv: '1.9.1', v8: '5.0.71.60', zlib: '1.2.8' }
cordova-plugin-camera
entry in your config.xml? – Singularcordova plugins
andcordova platforms
and put the results on the question? – Singularcordova platform rm android
and thencordova platform add android
? – Singular