Nullpointerexception: Attempt To Invoke Virtual Method 'void Org.apache.cordova.cordovaplugin.privateinitialize
Solution 1:
I got some clues from the other questions and because I was refactoring I had been working with the plugin.xml file.
I noticed that I had this difference from other plugin.xml files:
<featurename="CDVProcessLog"><paramname="android-package"value="xyz.meris.processlog.CDVProcessLog" /><paramname="onload"value="true" /></feature><featurename="ProcessLog"><paramname="android-package"value="xyz.meris.processlog.ProcessLog" />
+ <paramname="onload"value="true" /></feature>Because I copied the <feature> tag and just filled it in I had copied the onload parameter. Once I removed the duplicate onload parameter the crash stopped happening.
EDIT: erp. Turns out I had another error that was causing this issue.
Removing the onload param lazy loaded ProcessLog. So I would get a null pointer error later.
My real problem was that my .js file did not get updated with my CordovaPlugin class name. I had changed it from ProcessLogto CDVProcessLog. ProcessLog now had the specifics for processing the log and CDVProcessLog had mostly cordova glue to call my methods in ProcessLog.
My .js file needed to change:
returnnewPromise((resolve, reject) => {
- exec(resolve, reject, 'ProcessLog', func, [...args]);
+ exec(resolve, reject, 'CDVProcessLog', func, [...args]);
});
Post a Comment for "Nullpointerexception: Attempt To Invoke Virtual Method 'void Org.apache.cordova.cordovaplugin.privateinitialize"