paytabscom / paytabs-android-library-sample

Sample for Paytabs android library
MIT License
11 stars 7 forks source link

Get life cycle exception #45

Closed IMrCrimeI closed 4 months ago

IMrCrimeI commented 1 year ago

Hello, in my project, when I try to run SDK on Xiaomi phones, I get the following error get life cycle exception java.lang.ClassCastException: android.os.BinderProxy cannot be cast to android.app.servertransaction.ClientTransaction at android.app.ActivityInjector.checkAccessControl(ActivityInjector.java:24) at android.app.Activity.onResume(Activity.java:2011) at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:309) at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1459) at android.app.Activity.performResume(Activity.java:8292) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4625) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4667) at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:58) at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5640) at android.app.ActivityThread.access$3500(ActivityThread.java:261) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2182) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8163) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) but when I run your demo on the same phone, everything works fine, could you tell me what could be the reason, tested on Xiaomi Redmi 10C and Xiaomi Redmi 9

IMrCrimeI commented 1 year ago

OK, I found the reason for the looping reload of the activity, in my project I use Per-app language preferences https://developer.android.com/guide/topics/resources/app-languages, and the service specified in the manifest <service android:name="androidx.appcompat.app.AppLocalesMetadataHolderService" android:enabled="false" android:exported="false"> <meta-data android:name="autoStoreLocales" android:value="true" /> </service> In my Activity, I use code that changes the locale AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(language)) If I remove the service and remove the code that changes the locale, then everything works fine