Ionic Camera Attempt to invoke virtual method












0















We installed the Camera Plugin for Ionic and are facing this error:



Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference


We have already tried all the solutions provided at the
link
How can we fix it? Our (original) Manifest is:



 <?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
</provider>
<service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementService" />
<service android:name="org.apache.cordova.firebase.FirebasePluginMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="org.apache.cordova.firebase.FirebasePluginInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<receiver android:name="org.apache.cordova.firebase.OnNotificationOpenReceiver" />
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>


20/NOV:
To explain further, we attached the Camera call in code. First function successfully opens Gallery with specified sourceType. Second function fails with source type CAMERA in error mentioned above. We are using the plugin QR Scanner in same project, there the camera opens and is functional.



openGallery () {
let cameraOptions = {
sourceType: this.Camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.Camera.DestinationType.DATA_URL,
quality: 100,
targetWidth: 1000,
targetHeight: 1000,
encodingType: this.Camera.EncodingType.JPEG,
correctOrientation: true
}
this.Camera.getPicture(cameraOptions)
.then(imageData => {
this.base64Image = 'data:image/jpeg;base64,' + imageData;
err => console.log(err);});


}

takePhoto() {
let cameraOptions = {
sourceType: this.Camera.PictureSourceType.CAMERA,
destinationType: this.Camera.DestinationType.FILE_URI,
quality: 100,
targetWidth: 1000,
targetHeight: 1000,
encodingType: this.Camera.EncodingType.JPEG,
correctOrientation: true,
}
this.Camera.getPicture(cameraOptions)
.then(file_uri => {
console.log(file_uri);
},
err => console.log(err));


}









share|improve this question

























  • Possible duplicate of What is a NullPointerException, and how do I fix it?

    – Sean Pianka
    Nov 15 '18 at 20:45
















0















We installed the Camera Plugin for Ionic and are facing this error:



Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference


We have already tried all the solutions provided at the
link
How can we fix it? Our (original) Manifest is:



 <?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
</provider>
<service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementService" />
<service android:name="org.apache.cordova.firebase.FirebasePluginMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="org.apache.cordova.firebase.FirebasePluginInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<receiver android:name="org.apache.cordova.firebase.OnNotificationOpenReceiver" />
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>


20/NOV:
To explain further, we attached the Camera call in code. First function successfully opens Gallery with specified sourceType. Second function fails with source type CAMERA in error mentioned above. We are using the plugin QR Scanner in same project, there the camera opens and is functional.



openGallery () {
let cameraOptions = {
sourceType: this.Camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.Camera.DestinationType.DATA_URL,
quality: 100,
targetWidth: 1000,
targetHeight: 1000,
encodingType: this.Camera.EncodingType.JPEG,
correctOrientation: true
}
this.Camera.getPicture(cameraOptions)
.then(imageData => {
this.base64Image = 'data:image/jpeg;base64,' + imageData;
err => console.log(err);});


}

takePhoto() {
let cameraOptions = {
sourceType: this.Camera.PictureSourceType.CAMERA,
destinationType: this.Camera.DestinationType.FILE_URI,
quality: 100,
targetWidth: 1000,
targetHeight: 1000,
encodingType: this.Camera.EncodingType.JPEG,
correctOrientation: true,
}
this.Camera.getPicture(cameraOptions)
.then(file_uri => {
console.log(file_uri);
},
err => console.log(err));


}









share|improve this question

























  • Possible duplicate of What is a NullPointerException, and how do I fix it?

    – Sean Pianka
    Nov 15 '18 at 20:45














0












0








0








We installed the Camera Plugin for Ionic and are facing this error:



Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference


We have already tried all the solutions provided at the
link
How can we fix it? Our (original) Manifest is:



 <?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
</provider>
<service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementService" />
<service android:name="org.apache.cordova.firebase.FirebasePluginMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="org.apache.cordova.firebase.FirebasePluginInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<receiver android:name="org.apache.cordova.firebase.OnNotificationOpenReceiver" />
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>


20/NOV:
To explain further, we attached the Camera call in code. First function successfully opens Gallery with specified sourceType. Second function fails with source type CAMERA in error mentioned above. We are using the plugin QR Scanner in same project, there the camera opens and is functional.



openGallery () {
let cameraOptions = {
sourceType: this.Camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.Camera.DestinationType.DATA_URL,
quality: 100,
targetWidth: 1000,
targetHeight: 1000,
encodingType: this.Camera.EncodingType.JPEG,
correctOrientation: true
}
this.Camera.getPicture(cameraOptions)
.then(imageData => {
this.base64Image = 'data:image/jpeg;base64,' + imageData;
err => console.log(err);});


}

takePhoto() {
let cameraOptions = {
sourceType: this.Camera.PictureSourceType.CAMERA,
destinationType: this.Camera.DestinationType.FILE_URI,
quality: 100,
targetWidth: 1000,
targetHeight: 1000,
encodingType: this.Camera.EncodingType.JPEG,
correctOrientation: true,
}
this.Camera.getPicture(cameraOptions)
.then(file_uri => {
console.log(file_uri);
},
err => console.log(err));


}









share|improve this question
















We installed the Camera Plugin for Ionic and are facing this error:



Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference


We have already tried all the solutions provided at the
link
How can we fix it? Our (original) Manifest is:



 <?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="org.apache.cordova.camera.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/camera_provider_paths" />
</provider>
<service android:enabled="true" android:exported="false" android:name="com.google.android.gms.measurement.AppMeasurementService" />
<service android:name="org.apache.cordova.firebase.FirebasePluginMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="org.apache.cordova.firebase.FirebasePluginInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<receiver android:name="org.apache.cordova.firebase.OnNotificationOpenReceiver" />
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>


20/NOV:
To explain further, we attached the Camera call in code. First function successfully opens Gallery with specified sourceType. Second function fails with source type CAMERA in error mentioned above. We are using the plugin QR Scanner in same project, there the camera opens and is functional.



openGallery () {
let cameraOptions = {
sourceType: this.Camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.Camera.DestinationType.DATA_URL,
quality: 100,
targetWidth: 1000,
targetHeight: 1000,
encodingType: this.Camera.EncodingType.JPEG,
correctOrientation: true
}
this.Camera.getPicture(cameraOptions)
.then(imageData => {
this.base64Image = 'data:image/jpeg;base64,' + imageData;
err => console.log(err);});


}

takePhoto() {
let cameraOptions = {
sourceType: this.Camera.PictureSourceType.CAMERA,
destinationType: this.Camera.DestinationType.FILE_URI,
quality: 100,
targetWidth: 1000,
targetHeight: 1000,
encodingType: this.Camera.EncodingType.JPEG,
correctOrientation: true,
}
this.Camera.getPicture(cameraOptions)
.then(file_uri => {
console.log(file_uri);
},
err => console.log(err));


}






android ionic-framework camera xmlresourceparser






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 16:17







muffin and cake

















asked Nov 15 '18 at 20:39









muffin and cakemuffin and cake

12




12













  • Possible duplicate of What is a NullPointerException, and how do I fix it?

    – Sean Pianka
    Nov 15 '18 at 20:45



















  • Possible duplicate of What is a NullPointerException, and how do I fix it?

    – Sean Pianka
    Nov 15 '18 at 20:45

















Possible duplicate of What is a NullPointerException, and how do I fix it?

– Sean Pianka
Nov 15 '18 at 20:45





Possible duplicate of What is a NullPointerException, and how do I fix it?

– Sean Pianka
Nov 15 '18 at 20:45












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327571%2fionic-camera-attempt-to-invoke-virtual-method%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327571%2fionic-camera-attempt-to-invoke-virtual-method%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python