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
}
}
Related
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 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)
I am making this post today because I have a problem with my ionic application.
So here it is, the app builds perfectly on an emulator with android studio. However, right after the splash screen it crashes instantly. I have no idea why this is happening. After running the app in debug mode, I get this error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.julesbsz.shortnews, PID: 862
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.julesbsz.shortnews/com.julesbsz.shortnews.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2016)
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 'int org.json.JSONArray.length()' on a null object reference
at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.load(GoogleAuth.java:47)
at com.getcapacitor.PluginHandle.load(PluginHandle.java:72)
at com.getcapacitor.PluginHandle.<init>(PluginHandle.java:44)
at com.getcapacitor.Bridge.registerPlugin(Bridge.java:476)
at com.getcapacitor.Bridge.registerAllPlugins(Bridge.java:440)
at com.getcapacitor.Bridge.<init>(Bridge.java:170)
at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:83)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:62)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:48)
at com.julesbsz.shortnews.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2016)
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)
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'
I really don't see what the problem is. Also, if you need more information about something in particular, let me know. Thank you very much.
If you read the stacktrace you can see that the crash originates from
at com.julesbsz.shortnews.MainActivity.onCreate(MainActivity.java:17)
It then appears to fail at some authorization logic
at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.load(GoogleAuth.java:47)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
You did not post your code so perhaps this is a good time to learn how to set breakpoints and debug?
https://developer.android.com/studio/debug#breakPoints
I have added every needed dependency and plugins. My project is also generating third_party_licences files, but my app crashes when activity OssLicensesMenuActivity starts.
Errors here:
E/GmsClient: unable to connect to service: com.google.android.gms.oss.licenses.service.START on com.google.android.gms
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.axabee.seeplaces, PID: 12102
java.lang.NullPointerException: Attempt to invoke virtual method 'long com.google.android.gms.internal.oss_licenses.zzc.zze()' on a null object reference
at com.google.android.gms.internal.oss_licenses.zze.zza(Unknown Source:19)
at com.google.android.gms.oss.licenses.zzf.onComplete(Unknown Source:28)
at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
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)
Suddently, during regular usage of my Nexus 5, the Google Play Store started crashing every time I try to open it.
So, I tried to get the log of the error, here it is:
11664-11664/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.android.vending, PID: 11664
java.lang.RuntimeException: Unable to create application com.google.android.finsky.FinskyApp: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
at android.app.ActivityThread.handleBindApplication(<Xposed>)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference
at android.os.Parcel.readException(Parcel.java:1605)
at android.os.Parcel.readException(Parcel.java:1552)
at android.content.pm.IPackageInstaller$Stub$Proxy.getMySessions(IPackageInstaller.java:385)
at android.content.pm.PackageInstaller.getMySessions(PackageInstaller.java:415)
at com.google.android.finsky.installer.PackageInstallerImpl.<init>(PackageInstallerImpl.java:71)
at com.google.android.finsky.installer.PackageInstallerFactory.init(PackageInstallerFactory.java:23)
at com.google.android.finsky.FinskyApp.onCreate(FinskyApp.java:387)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:334)
at android.app.ActivityThread.handleBindApplication(<Xposed>)
at android.app.ActivityThread.-wrap1(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:102) `
I tried to look for this error online, but couldn't find anything. I assume it's related to some system app that has one of her permissions unapproved (I don't know which could be the one), or maybe related to my Xposed Framework installation.
What could it be?
Thank you for your help.
its not any other problem did you see Attempt to invoke virtual method 'void android.app.AppOpsManager.checkPackage(int, java.lang.String)' on a null object reference. you have calling some null object reference.