nativescript-camera-plus icon indicating copy to clipboard operation
nativescript-camera-plus copied to clipboard

bad base-64

Open carrbrpoa opened this issue 6 years ago • 2 comments

Just added the plugin to my Android app and, testing with real device, as soon as I open the modal which contains the plugin, an exception is thrown:

ERROR Error: Uncaught (in promise): Error: java.lang.IllegalArgumentException: bad base-64
    android.util.Base64.decode(Base64.java:161)
    android.util.Base64.decode(Base64.java:136)
    android.util.Base64.decode(Base64.java:118)
    com.tns.Runtime.callJSMethodNative(Native Method)
    com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
    com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
    com.tns.Runtime.callJSMethod(Runtime.java:957)
    com.tns.Runtime.callJSMethod(Runtime.java:941)
    com.tns.Runtime.callJSMethod(Runtime.java:933)
    com.tns.gen.java.lang.Runnable.run(Runnable.java:10)
    android.os.Handler.handleCallback(Handler.java:739)
    android.os.Handler.dispatchMessage(Handler.java:95)
    android.os.Looper.loop(Looper.java:158)
    android.app.ActivityThread.main(ActivityThread.java:7230)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Error: java.lang.IllegalArgumentException: bad base-64
    android.util.Base64.decode(Base64.java:161)
    android.util.Base64.decode(Base64.java:136)
    android.util.Base64.decode(Base64.java:118)
    com.tns.Runtime.callJSMethodNative(Native Method)
    com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
    com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
    com.tns.Runtime.callJSMethod(Runtime.java:957)
    com.tns.Runtime.callJSMethod(Runtime.java:941)
    com.tns.Runtime.callJSMethod(Runtime.java:933)
    com.tns.gen.java.lang.Runnable.run(Runnable.java:10)
    android.os.Handler.handleCallback(Handler.java:739)
    android.os.Handler.dispatchMessage(Handler.java:95)
    android.os.Looper.loop(Looper.java:158)
    android.app.ActivityThread.main(ActivityThread.java:7230)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    at ImageSource.module.exports.ImageSource.loadFromBase64 (file:///data/data/br.my.app/files/app/vendor.js:22182:45)
    at file:///data/data/br.my.app/files/app/vendor.js:22190:27
    at new ZoneAwarePromise (file:///data/data/br.my.app/files/app/vendor.js:72708:29)
    at ImageSource.module.exports.ImageSource.fromBase64 (file:///data/data/br.my.app/files/app/vendor.js:22189:16)
    at Image.module.exports.ImageBase._createImageSourceFromSrc (file:///data/data/br.my.app/files/app/vendor.js:74987:34)
    at Image.module.exports.Image._createImageSourceFromSrc (file:///data/data/br.my.app/files/app/vendor.js:74841:60)
    at Image.module.exports.Image.(anonymous function) (file:///data/data/br.my.app/files/app/vendor.js:74913:14)
    at Image.Property.set [as src] (file:///data/data/br.my.app/files/app/vendor.js:19488:44)
    at ViewUtil.module.exports.ViewUtil.setPropertyInternal (file:///data/data/br.my.app/files/app/vendor.js:78489:32)
    at ViewUtil.module.exports.ViewUtil.setProperty (file:///data/data/br.my.app/files/app/vendor.js:78468:18)
    at EmulatedRenderer.module.exports.NativeScriptRenderer.setProperty (file:///data/data/br.my.app/files/app/bundle.js:51204:30)
    at DebugRenderer2.module.exports.DebugRenderer2.setProperty (file:///data/data/br.my.app/files/app/vendor.js:15424:23)
    at setElementProperty (file:///data/data/br.my.app/files/app/vendor.js:10806:19)
    at checkAndUpdateElementValue (file:///data/data/br.my.app/files/app/vendor.js:10725:13)
    at checkAndUpdateElementInline (file:///data/data/br.my.app/files/app/vendor.js:10659:24)

TNS 3.4.2

carrbrpoa avatar Aug 29 '18 13:08 carrbrpoa

Can you try it on the page and not in a modal, curious if that has something to do with it? This would be a new issue I've never seen with the plugin during dev. so let me know what else you can find out

bradmartin avatar Aug 29 '18 14:08 bradmartin

Thanks for the reply @bradmartin. Manage to make it work in a Page, as you said. The problem seems to be only with my modal, which I do open like this:

let options: ModalDialogOptions = {
	viewContainerRef: this.vcRef,
	fullscreen: true
};
// >> returning-result
this._modalService.showModal(MyModalPictureComponent, options).then(() => this.loading = false);

I can survive without the modal, I guess.

carrbrpoa avatar Aug 29 '18 16:08 carrbrpoa