I am working on the android studio when I am trying payment gateway integration using Razorpay. when I am using the card payment method it is working fine but whenever using the UPI payment method it gives the following error.
com.example.navdrawerdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.navdrawerdemo, PID: 31569
java.lang.RuntimeException: Unable to destroy activity {com.example.navdrawerdemo/com.razorpay.CheckoutActivity}: java.lang.IllegalArgumentException: Receiver not registered: null
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5112)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5141)
at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2067)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7697)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
Caused by: java.lang.IllegalArgumentException: Receiver not registered: null
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1459)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1642)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:715)
at com.razorpay.CheckoutPresenterImpl.cleanUpOnDestroy(CheckoutPresenterImpl.java:705)
at com.razorpay.PluginOtpElfCheckoutPresenterImpl.cleanUpOnDestroy(PluginOtpElfCheckoutPresenterImpl.java:17)
at com.razorpay.a_$P$.onDestroy(BaseCheckoutActivity.java:178)
at android.app.Activity.performDestroy(Activity.java:8245)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1345)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5097)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5141)
at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2067)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7697)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
Related
I noticed one exception (Firebase Crashlytics) for Android 13 devices, no other devices, happened many times, only for one device till now.
I do not know why we getting NullPointerException we just use google sign in and firebase anonymous signin in our app.
What is com.google.firebase.auth.internal.GenericIdpActivity in firebase auth lib?
From Firebase Crashlytics:
Fatal Exception: java.lang.RuntimeException: Unable to resume activity {<my package name>t/com.google.firebase.auth.internal.GenericIdpActivity}: java.lang.NullPointerException: null reference
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5368)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5434)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8747)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Caused by java.lang.NullPointerException: null reference
at com.google.android.gms.common.internal.Preconditions.checkNotNull(com.google.android.gms:play-services-basement##18.1.0:1)
at com.google.android.gms.internal.firebase-auth-api.zzxq.<init>(com.google.firebase:firebase-auth##21.0.6:5)
at com.google.firebase.auth.internal.GenericIdpActivity.onResume(com.google.firebase:firebase-auth##21.0.6:20)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1531)
at android.app.Activity.performResume(Activity.java:8734)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5341)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5434)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8747)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Upgraded Android API Level to 31 and then had to update Unity FB sdk (updated FB SDK to fix this).
In the new updated SDK when we try to facebook login we the game crashes and this is the device log
2022-10-18 12:36:22.428 2310-2310/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.risingtidegames.blackdiamondslots.beta, PID: 2310
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/activity/result/ActivityResultRegistryOwner;
at com.facebook.login.LoginManager.logIn(LoginManager.java:838)
at com.facebook.login.LoginManager.logInWithReadPermissions(LoginManager.java:572)
at com.facebook.unity.FBLogin.login(FBLogin.java:163)
at com.facebook.unity.FBLogin.loginWithReadPermissions(FBLogin.java:44)
at com.facebook.unity.FBUnityLoginActivity.onCreate(FBUnityLoginActivity.java:40)
at android.app.Activity.performCreate(Activity.java:8290)
at android.app.Activity.performCreate(Activity.java:8270)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4009)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: java.lang.ClassNotFoundException: androidx.activity.result.ActivityResultRegistryOwner
at com.facebook.login.LoginManager.logIn(LoginManager.java:838)
at com.facebook.login.LoginManager.logInWithReadPermissions(LoginManager.java:572)
at com.facebook.unity.FBLogin.login(FBLogin.java:163)
at com.facebook.unity.FBLogin.loginWithReadPermissions(FBLogin.java:44)
at com.facebook.unity.FBUnityLoginActivity.onCreate(FBUnityLoginActivity.java:40)
at android.app.Activity.performCreate(Activity.java:8290)
at android.app.Activity.performCreate(Activity.java:8270)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4009)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)```
I am starting to setup some instrumented tests on my project, but when I run them, I get the following exception on logcat:
2022-04-11 10:41:09.352 24409-24409/com.example.appstartupinstrumentationtest E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.appstartupinstrumentationtest, PID: 24409
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: java.lang.IllegalStateException: The component was not created. Check that you have added the HiltAndroidRule.
at android.app.ActivityThread.installProvider(ActivityThread.java:8195)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7726)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7546)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2166)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: androidx.startup.StartupException: java.lang.IllegalStateException: The component was not created. Check that you have added the HiltAndroidRule.
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:162)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:198)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:38)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2429)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2399)
at android.app.ActivityThread.installProvider(ActivityThread.java:8190)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7726)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7546)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2166)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.lang.IllegalStateException: The component was not created. Check that you have added the HiltAndroidRule.
at dagger.hilt.internal.Preconditions.checkState(Preconditions.java:83)
at dagger.hilt.android.internal.testing.TestApplicationComponentManager.generatedComponent(TestApplicationComponentManager.java:96)
at dagger.hilt.android.testing.HiltTestApplication.generatedComponent(HiltTestApplication.java:49)
at dagger.hilt.EntryPoints.get(EntryPoints.java:59)
at dagger.hilt.android.EntryPointAccessors.fromApplication(EntryPointAccessors.kt:35)
at com.example.appstartupinstrumentationtest.InitializerEntryPoint$Companion.resolve(InitializerEntryPoint.kt:20)
at com.example.appstartupinstrumentationtest.SomeComponentInitializer.create(SomeComponentInitializer.kt:10)
at com.example.appstartupinstrumentationtest.SomeComponentInitializer.create(SomeComponentInitializer.kt:7)
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:155)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:198)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:38)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2429)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2399)
at android.app.ActivityThread.installProvider(ActivityThread.java:8190)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7726)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7546)
at android.app.ActivityThread.access$1500(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2166)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8633)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
My real codebase is much more complex, but I created a much simpler project where I am able to reproduce the issue HERE.
From what I understood, when running the instrumentation tests, the startup code is first executed, even before anything on the test class (before #Before and #BeforeClass methods).
What is the best way to handle this?
I have initialized Firebase on Application onCreate() :
FirebaseApp.initializeApp(getApplicationContext());
then try to binding isolate process on Activity
bindService(intent, mIsolatedServiceConnection, BIND_AUTO_CREATE);
Firebase has crashed with below exception, Could someone help me to fix this bug?
2020-05-25 11:47:13.700 27703-27703/com.test.process_v:tmp:com.test.process.IsolatedService W/ContextImpl: Failed to ensure /data/user/0/com.test.process_v/shared_prefs: mkdir failed: EACCES (Permission denied)
2020-05-25 11:47:13.700 27703-27703/com.test.process_v:tmp:com.test.process.IsolatedService W/SystemServiceRegistry: No service published for: user
2020-05-25 11:47:13.701 27703-27703/com.test.process_v:tmp:com.test.process.IsolatedService D/AndroidRuntime: Shutting down VM
--------- beginning of crash
2020-05-25 11:47:13.702 27703-27703/com.test.process_v:tmp:com.test.process.IsolatedService E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.darvin.security_v:tmp:com.test.process.IsolatedService, PID: 27703
java.lang.RuntimeException: Unable to create application com.test.process.App: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.UserManager.isUserUnlockingOrUnlocked(int)' on a null object reference
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6465)
at java.lang.reflect.Method.invoke(Native Method)
at com.swift.sandhook.SandHook.callOriginMethod(SandHook.java:185)
at com.swift.sandhook.xposedcompat.hookstub.HookStubManager.hookBridge(HookStubManager.java:375)
at SandHookerNew_5sm3dthec8858ee0to4kj3c1ge.hook(Unknown Source:51)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.UserManager.isUserUnlockingOrUnlocked(int)' on a null object reference
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:457)
at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:443)
at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:178)
at com.google.firebase.FirebaseApp.<init>(com.google.firebase:firebase-common##16.0.2:528)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##16.0.2:355)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##16.0.2:324)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##16.0.2:310)
at com.test.process.App.onCreate(App.java:32)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1189)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
at java.lang.reflect.Method.invoke(Native Method)
at com.swift.sandhook.SandHook.callOriginMethod(SandHook.java:185)
at com.swift.sandhook.xposedcompat.hookstub.HookStubManager.hookBridge(HookStubManager.java:375)
at SandHookerNew_5sm3dthec8858ee0to4kj3c1ge.hook(Unknown Source:51)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
If Firebase has initialized on Activity then no crashed happen.
Check in your application onCreate() if process that runs it is isolated. If not - run initialization of Firebase.
override fun onCreate() {
super.onCreate()
if (!android.os.Process.isIsolated()) {
//init firebase
}
}
Not able to run instrumentation test with android orchestrator,
I have followed developer doc and made same changes but it's not working.
Screen shot and logs are attached.
Any help would be appreciated thanks in advance
Logcat:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ctpl.myinstrumentationtest, PID: 6608
java.lang.RuntimeException: Exception thrown in onCreate() of ComponentInfo{com.example.ctpl.myinstrumentationtest.test/android.support.test.runner.AndroidJUnitRunner}: java.lang.RuntimeException: Cannot connect to android.support.test.orchestrator.OrchestratorService
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5868)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.RuntimeException: Cannot connect to android.support.test.orchestrator.OrchestratorService
at android.support.test.orchestrator.instrumentationlistener.OrchestratedInstrumentationListener.connect(OrchestratedInstrumentationListener.java:87)
at android.support.test.runner.AndroidJUnitRunner.onCreate(AndroidJUnitRunner.java:303)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5863)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
List item
I had the same problem but with androidx orchestrator. I was getting the same exception but the package was different:
Caused by: java.lang.RuntimeException: Cannot connect to androidx.test.orchestrator.OrchestratorService.
I have found the description of possbile root cause in this github thread. There's an iteresting discussion, but it seems that there's no general solution for this yet.
For me the problem was caused by setting the target sdk to 30 and launching the app on an android 30 emulator. So launching tests on emulator with api < 30 resolved this.