Nets-mobile-acceptance / Netaxept-Android-SDK

PiA Netaxept Android SDK is a library that provides the native In-App interaction to perform Netaxept payments directly from an app on Android devices while minimizing PCI DSS requirements for you.
31 stars 15 forks source link

FragmentStrictMode violations in SDK #63

Closed cf256 closed 1 year ago

cf256 commented 2 years ago

When using FragmentStrictMode there are multiple warnings when using the SDK. Example when adding a payment card. This is not critical, but it would be nice if it was fixed in a future release.

This can easily be reproduced by adding the following to your onCreate in the Application class:

  FragmentStrictMode.defaultPolicy =
            FragmentStrictMode.Policy.Builder()
                .detectFragmentReuse()
                .detectFragmentTagUsage()
                .detectRetainInstanceUsage()
                .detectSetUserVisibleHint()
                .detectTargetFragmentUsage()
                .detectWrongFragmentContainer()
                .apply {
                    penaltyListener {
                      Log.i("TAG", "FragmentStrictModeViolation")
                    }
                }.build()

Non-fatal Exception: androidx.fragment.app.strictmode.WrongFragmentContainerViolation: Attempting to add fragment d{7f60759} (62ce6f78-8bfe-4186-b76e-b759149ebc4e id=0x7f090289 tag=TAG_CARD_FORM_FRAGMENT) to container android.widget.FrameLayout{1d46f1e V.E...... ......ID 0,0-720,1204 #7f090289 app:id/main_content_container} which is not a FragmentContainerView at androidx.fragment.app.strictmode.FragmentStrictMode.onWrongFragmentContainer(FragmentStrictMode.java:204) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701) at androidx.fragment.app.FragmentController.execPendingActions(FragmentController.java:462) at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:481) at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:246) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1444) at android.app.Activity.performStart(Activity.java:8036) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3593) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2167) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:236) at android.app.ActivityThread.main(ActivityThread.java:7834) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:621) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)

Miss-PiA commented 2 years ago

Hi

We will be fixing this in the next release

Thanks

Miss-PiA commented 1 year ago

Hi, Issue has been fixed in Netaxept-Android-SDK v2.7.0. Thanks