Develop plugin error


#1

Hi. How are you,

I joined a developer of applications for Android and iOS using Nativescript, but there were not too many plugins for payment methods, covering availability in Mexico, so I decided to create a plugin using:

https://developers.conekta.com/libraries

But when the development for Android the error is as follows:

chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
04-28 10:38:01.405 31048 31048 I cr_BrowserStartup: Initializing chromium process, singleProcess=true
04-28 10:38:01.496 31048 31048 I art     : Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.db>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/RenderProcessGoneDetail;
04-28 10:38:01.496 31048 31048 I art     :   at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:48)
04-28 10:38:01.496 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[]) (Runtime.java:-2)
04-28 10:38:01.496 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.dispatchCallJSMethodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[]) (Runtime.java:1088)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethodImpl(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:970)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:957)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[]) (Runtime.java:941)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[]) (Runtime.java:933)
04-28 10:38:01.497 31048 31048 I art     :   at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:48)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[]) (Runtime.java:-2)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.dispatchCallJSMethodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[]) (Runtime.java:1088)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethodImpl(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:970)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:957)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[]) (Runtime.java:941)
04-28 10:38:01.497 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[]) (Runtime.java:933)
04-28 10:38:01.502 31048 31048 I art     : Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.hb>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/SafeBrowsingResponse;
04-28 10:38:01.502 31048 31048 I art     :   at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:48)
04-28 10:38:01.502 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[]) (Runtime.java:-2)
04-28 10:38:01.502 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.dispatchCallJSMethodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[]) (Runtime.java:1088)
04-28 10:38:01.502 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethodImpl(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:970)
04-28 10:38:01.502 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:957)
04-28 10:38:01.502 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[]) (Runtime.java:941)
04-28 10:38:01.502 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[]) (Runtime.java:933)
04-28 10:38:01.502 31048 31048 I art     :   at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:48)
04-28 10:38:01.502 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[]) (Runtime.java:-2)
04-28 10:38:01.502 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.dispatchCallJSMethodNative(int, java.lang.String, boolean, long, java.lang.Class, java.lang.Object[]) (Runtime.java:1088)
04-28 10:38:01.503 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethodImpl(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:970)
04-28 10:38:01.503 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, long, java.lang.Object[]) (Runtime.java:957)
04-28 10:38:01.503 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, boolean, java.lang.Object[]) (Runtime.java:941)
04-28 10:38:01.503 31048 31048 I art     :   at java.lang.Object com.tns.Runtime.callJSMethod(java.lang.Object, java.lang.String, java.lang.Class, java.lang.Object[]) (Runtime.java:933)
chromium: [INFO:CONSOLE(7)] "[bugsnag]", source: https://conektaapi.s3.amazonaws.com/v0.5.0/js/conekta.js (7)
JS:

My code is as follows:

import * as app from "tns-core-modules/application";

import { Common } from './conekta.common';

let activity = app.android.startActivity || app.android.foregroundActivity;
declare const io, org: any;

export class Conekta extends Common {

    get() {

        let mToken: string;
        
        io.conekta.conektasdk.Conekta.setPublicKey("PUBLIC_KEY"); //Set public key
        io.conekta.conektasdk.Conekta.setApiVersion("1.0.0"); //Set api version (optional)
        io.conekta.conektasdk.Conekta.collectDevice(activity); //Collect device
        // androidApp.startActivity
        //application.AndroidApplication
        var card = new io.conekta.conektasdk.Card("Josue Camara", "4242424242424242", "332", "11", "2017");
        var token = new io.conekta.conektasdk.Token(activity);
        
        token.onCreateTokenListener(new io.conekta.conektasdk.Token.CreateToken({
                onCreateTokenReady: function(data: org.json.JSONObject) {
                    try {
                         mToken = data.toString();
                    } catch(e) {
                        console.log("Error token");
                    }
                    
                }
            })
        );
        
        token.create(card);//Create token

        return mToken;
    }

}

I hope and you can support me.

Greetings and thanks.


#3

@nericode
Any solution on this one ? I was reported it when I tried that plugin :
https://github.com/EddyVerbruggen/nativescript-admob/issues/30


#4

Thanks, I already solved problem !!

Link: https://github.com/NeriCodec/nativescript-conekta/commit/ea0ed70595278e4efa7d47d68a21e213d2cb44a3