Poynt launch payment fragment error Class not found when unmarshalling: co.poynt.os.model.b

Hi, I am trying to launch the Payment fragment on a Production Poynt 5 but I am getting an error that is preventing the fragment from launching. I tested successfully on a Poynt P3303-B V2.0. I am wondering if perhaps I missed something that should be done differently?

build.gradle
dependencies {
testImplementation ‘junit:junit:4.12’
androidTestImplementation ‘com.android.support.test:runner:1.0.2’
androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2’

// Poynt Dependencies
implementation 'co.poynt.api:android-api-model:1.2.140'
implementation 'co.poynt.android.sdk:poynt-sdk:1.2.42'
implementation 'com.google.code.gson:gson:2.8.2'

// JWT dependencies - if you want to parse JWTs
implementation 'net.jcip:jcip-annotations:1.0@jar'
implementation 'com.nimbusds:nimbus-jose-jwt:2.26@jar'
implementation 'net.minidev:json-smart:1.2@jar'

}

logs:
ActivityManager: START u0 {act=poynt.intent.action.COLLECT_PAYMENT cmp=co.poynt.services/.payments.PoyntPaymentActivity (has extras)} from uid 10057 from pid 5717 on display 0

10-22 10:02:38.511 1384 1384 E Parcel : Class not found when unmarshalling: co.poynt.os.model.b
10-22 10:02:38.511 1384 1384 E Parcel : java.lang.ClassNotFoundException: co.poynt.os.model.b
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.Class.classForName(Native Method)
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.Class.forName(Class.java:324)
10-22 10:02:38.511 1384 1384 E Parcel : at android.os.Parcel.readParcelableCreator(Parcel.java:2383)
10-22 10:02:38.511 1384 1384 E Parcel : at android.os.Parcel.readParcelable(Parcel.java:2337)
10-22 10:02:38.511 1384 1384 E Parcel : at android.os.Parcel.readValue(Parcel.java:2243)
10-22 10:02:38.511 1384 1384 E Parcel : at android.os.Parcel.readArrayMapInternal(Parcel.java:2592)
10-22 10:02:38.511 1384 1384 E Parcel : at android.os.BaseBundle.unparcel(BaseBundle.java:221)
10-22 10:02:38.511 1384 1384 E Parcel : at android.os.Bundle.getParcelable(Bundle.java:786)
10-22 10:02:38.511 1384 1384 E Parcel : at android.content.Intent.getParcelableExtra(Intent.java:5575)
10-22 10:02:38.511 1384 1384 E Parcel : at co.poynt.services.payments.PoyntPaymentActivity.handleIntent(PoyntPaymentActivity.java:205)
10-22 10:02:38.511 1384 1384 E Parcel : at co.poynt.services.payments.PoyntPaymentActivity.onCreate(PoyntPaymentActivity.java:120)
10-22 10:02:38.511 1384 1384 E Parcel : at android.app.Activity.performCreate(Activity.java:6315)
10-22 10:02:38.511 1384 1384 E Parcel : at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
10-22 10:02:38.511 1384 1384 E Parcel : at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
10-22 10:02:38.511 1384 1384 E Parcel : at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
10-22 10:02:38.511 1384 1384 E Parcel : at android.app.ActivityThread.-wrap11(ActivityThread.java)
10-22 10:02:38.511 1384 1384 E Parcel : at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
10-22 10:02:38.511 1384 1384 E Parcel : at android.os.Handler.dispatchMessage(Handler.java:111)
10-22 10:02:38.511 1384 1384 E Parcel : at android.os.Looper.loop(Looper.java:207)
10-22 10:02:38.511 1384 1384 E Parcel : at android.app.ActivityThread.main(ActivityThread.java:5728)
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.reflect.Method.invoke(Native Method)
10-22 10:02:38.511 1384 1384 E Parcel : at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
10-22 10:02:38.511 1384 1384 E Parcel : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)
10-22 10:02:38.511 1384 1384 E Parcel : Caused by: java.lang.ClassNotFoundException: Didn’t find class “co.poynt.os.model.b” on path: DexPathList[[zip file “/system/framework/android.test.runner.jar”, zip file “/system/priv-app/PoyntServices/PoyntServices.apk”],nativeLibraryDirectories=[/system/priv-app/PoyntServices/lib/arm, /system/priv-app/PoyntServices/PoyntServices.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
10-22 10:02:38.511 1384 1384 E Parcel : at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
10-22 10:02:38.511 1384 1384 E Parcel : … 23 more
10-22 10:02:38.511 1384 1384 E Parcel : Suppressed: java.lang.ClassNotFoundException: co.poynt.os.model.b
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.Class.classForName(Native Method)
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
10-22 10:02:38.511 1384 1384 E Parcel : at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
10-22 10:02:38.511 1384 1384 E Parcel : … 24 more
10-22 10:02:38.511 1384 1384 E Parcel : Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: Wrong payment object passed! Object must be of co.poynt.os.model.Payment type.
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: android.os.BadParcelableException: ClassNotFoundException when unmarshalling: co.poynt.os.model.b
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.os.Parcel.readParcelableCreator(Parcel.java:2411)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.os.Parcel.readParcelable(Parcel.java:2337)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.os.Parcel.readValue(Parcel.java:2243)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.os.Parcel.readArrayMapInternal(Parcel.java:2592)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.os.BaseBundle.unparcel(BaseBundle.java:221)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.os.Bundle.getParcelable(Bundle.java:786)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.content.Intent.getParcelableExtra(Intent.java:5575)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at co.poynt.services.payments.PoyntPaymentActivity.handleIntent(PoyntPaymentActivity.java:205)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at co.poynt.services.payments.PoyntPaymentActivity.onCreate(PoyntPaymentActivity.java:120)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.app.Activity.performCreate(Activity.java:6315)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.app.ActivityThread.-wrap11(ActivityThread.java)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.os.Handler.dispatchMessage(Handler.java:111)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.os.Looper.loop(Looper.java:207)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at android.app.ActivityThread.main(ActivityThread.java:5728)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at java.lang.reflect.Method.invoke(Native Method)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
10-22 10:02:38.512 1384 1384 E CO.POYNT.SERVICES: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)

Hi Jose,
could you please share how you are creating the intent for payment?

Sure, it is pretty much like the code sample

        Intent collectPaymentIntent = new Intent(Intents.ACTION_COLLECT_PAYMENT);
        collectPaymentIntent.putExtra(Intents.INTENT_EXTRAS_PAYMENT, payment);
        if(collectTip){
            activity.startActivityForResult(collectPaymentIntent, COLLECT_PAYMENT_WITH_TIP_REQUEST);
        } else {
            activity.startActivityForResult(collectPaymentIntent, COLLECT_PAYMENT_REQUEST);
        }

Could you also share the device serial number, I will pull the logs from my end.

Okay, thanks

P5SW122JT006496

Our payment application is interpreting the object sent in is of model co.poynt.os.model.b while it has to be co.poynt.os.model.payment.
One suggestion is to try setting the class loader for the intent extra so that it can be un-marshalled correclty.

Intent.setExtrasClassLoader(payment.getClass().getClassLoader());

Let us know if that helps.

Hi, Thank you for the suggestion, I tried this but it didn’t help. Maybe I’m missing something else. Would a Poynt 5 development kit be better to test with?

I tried printing the object class name at run time this is what I got:

Poynt P3303-B V2.0 Development kit:
Class of payment object passing to Poynt: co.poynt.os.model.Payment

Live Production Poynt 5:
Class of payment object passing to Poynt: co.poynt.os.model.b

Also changed the way I’m instantiating Payment to:
Payment payment = new co.poynt.os.model.Payment();

Imports:

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import com.google.gson.Gson;
import java.text.NumberFormat;
import co.poynt.os.model.Intents;
import co.poynt.os.model.Payment;
import co.poynt.os.services.v1.IPoyntTransactionService;

Hi, I managed to fix the issue.
We are making a Flutter app and we use Proguard for minification/obfuscation when making a release apk. This was causing the model name discrepancy.

Solution:
add this to proguard-rules.pro

-keep class co.poynt. { ; }*

Thank you for the help