I'm just trying to implement a simple Pusher beam notification from Pusher. i did a quick start from Pusher. I configured and added dependencies and stuff but whenever i use the curl command to try to send notification . it always crash . I've been trying to find the solution for hours but couldn't find it. It's driving me crazy . please help.
Here is my code in
MainActivitiy.kt
PushNotifications.start(this, "instance id")
PushNotifications.addDeviceInterest("hello")
here's the log :
E/AndroidRuntime: FATAL EXCEPTION: Firebase-WrappedFirebaseMessagingService
Process: com.example.azda, PID: 22200
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
at android.content.ContextWrapper.getSystemService(ContextWrapper.java:562)
at com.google.firebase.messaging.zzd.zza(com.google.firebase:firebase-messaging##20.0.0:10)
at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging##20.0.0:60)
at com.google.firebase.messaging.zze.run(com.google.firebase:firebase-messaging##20.0.0:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source)
at java.lang.Thread.run(Thread.java:818)
I found it . The problem is i shouldn’t use kotlin syntax of applicationContext when the solution is to use getApplicationContext() like in java .
Spent 10 hours just to write 2 lines of code . Felt so worthless and wanted to kill myself . Goddamn
Related
I'm facing a very annoying android crash that happens in around 1% of PRODUCTION the sessions with the app ALWAYS in the background.
Fatal Exception: android.app.RemoteServiceException: Attempt to invoke virtual method 'int com.android.server.wm.TaskDisplayArea.getDisplayId()' on a null object reference
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2054)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:250)
at android.app.ActivityThread.main(ActivityThread.java:7755)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
From this stack is clear that it comes from an internal android MainLooper operation... but the lack of extra information difficult for me to discover WHAT exactly
does anyone know what is this problem and how to solve it?
There's not a whole lot we can do with this level of information. The only thing I can see is this:
android.app.RemoteServiceException: Attempt to invoke virtual method 'int com.android.server.wm.TaskDisplayArea.getDisplayId()' on a null object reference
At some stage, your code is calling (or using a library which calls) getTaskDisplayArea() in com.android.server.wm. This returns null. It then tries to use this to getDisplayId().
(The rest of the error lines there just indicate it's not in the main thread)
It's likely that wherever you're using the TaskDisplayArea (or the library that calls it) is being called when the UI has been destroyed or has yet to be created.
The rarity indicates it probably is a total background restart of your UI/display elements... if I had to guess maybe caused by Android OS memory cleanup triggers while multitasking, or the user changing orientation repeatedly, etc etc.
If you give more details about where you've used the com.android.server.wm code or layouts you can probably get more help for how to make this background-thread-proof. Depending on what you're actually doing you might end up just catching the exception & retrying later, but some views will allow you to post info to the main thread and I don't know if TaskDisplayArea does.
In my case, I found that the project had a notification icon file in res/drawable-v24/ic_launcher_foreground.xml. The crashing stopped when I moved the .xml associated with v24 in the drawable res folder.
So I just released a new beta today with no changes to this piece of code. Strangely enough I got a new crash I've never seen before reported on Crashlytics. It has only happened to 2 users from two different manufacturers on Android 6 and 7. So it isn't a huge deal yet but I would still like to get it fixed.
Anyone have any idea what might be the issue here?
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference
at android.content.res.AssetManager.getResourceValue(AssetManager.java:206)
at android.content.res.Resources.getValue(Resources.java:1540)
at android.content.res.Resources.getDrawable(Resources.java:918)
at android.content.Context.getDrawable(Context.java:463)
at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:30)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:372)
Thanks.
Here is the code that causes the issue:
#Override
public Drawable getDefaultPlaceholderImage() {
return ContextCompat.getDrawable(this, R.drawable.default_placeholder);
}
I have the similar crashes at some devices (Samsung GT-I9505, Android 5). The error happens while parsing xml of the image. The cause of the error is the number with two points in the xml (it was "1.84.63" in my xml). Try to create all xml of images by another converter (for example, Vector Asset Studio).
I've been seeing this crash for a very small percent of users.
Fatal Exception: java.lang.NullPointerException
Attempt to invoke interface method 'boolean android.view.inputmethod.InputConnection.finishComposingText()' on a null object reference
called from android.view.inputmethod.InputConnectionWrapper.finishComposingText (InputConnectionWrapper.java:78)
The stack trace is all from Android system code, so I'm not sure how I'm triggering the crash. I think it has to do with how I've overridden the InputConnection on a WebView, but I'm not sure how exactly it's caused. Has anyone else seen this error or know how to fix it?
This was caused by Google employees dog fooding a new version of the webview. onCreateInputConnection in InputConnectionWrapper sometimes returns null now and you need to check that before using it to instantiate RichTextInputConnection.
I am getting a crash on Android Lolipop.
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference
at android.content.res.AssetManager.getResourceValue(AssetManager.java:213)
at android.content.res.Resources.getValue(Resources.java:1334)
at android.content.res.Resources.getValue(Resources.java:1323)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2796)
at android.content.res.Resources.getLayout(Resources.java:1143)
at android.view.LayoutInflater.inflate(LayoutInflater.java:412)
Generally happens while inflating a view.
Any suggestions why it happens on Lollipop only ?
It is may be because of an attribute is null.
For example android:foreground="?android:attr/selectableItemBackground" may be null, try to use android:foreground="?attr/selectableItemBackground".
In my case it occurred when I was setting a image to notification from service . I remove the relevant code and it started working fine
I wrote a remote service that the clients can log on with the usual mechanisms of IPC provided by Android and the binding seems to work. The problem arises when I go to call a method in which I have to pass an object as a parameter because I get this "curious" exception:
10-19 15:09:04.601: ERROR/AndroidRuntime(2985): FATAL EXCEPTION: main
10-19 15:09:04.601: ERROR/AndroidRuntime(2985): java.lang.NullPointerException
10-19 15:09:04.601: ERROR/AndroidRuntime(2985): at android.os.Parcel.readException(Parcel.java:1253)
10-19 15:09:04.601: ERROR/AndroidRuntime(2985):at android.os.Parcel.readException(Parcel.java:1235)
10-19 15:09:04.601: ERROR/AndroidRuntime(2985): at it.domod.commons.interfaces.DeviceManager$Stub$Proxy.sendCommand(DeviceManager.java:121)
It seems to be thrown from the proxy class generated from the .aidl file.
The more strange thing is that the object seems to be passed correctly but probably there is something wrong around. Any idea?
I've been encountering this issue as well and after a bit of poking around found the problem. I'm going to post my solution in case it helps others found drifting in the same boat.
Firstly debugging the remote thread doesn't work in Eclipse unless you enable debugging on the remote service. To do this I needed to run the app and put a breakpoint in my first activity that just binds the service, once the service is up and running I open the DDMS window in eclipse and select the remote thread and press the debug button. Now it's possible to jump back to the java window and add your breakpoints into the remote service and have them triggered.
From there I found my problem was actually I was trying to operate on a null pointer object in my stub function in the remote process which in turn injected a parcel exception for nullpointerexception in the result it was returning and looks like what this original question is asking about.
My solution was simply to test the object wasn't null before using it :)
i.e. I added the 'if' statement as you'd expect in the implementation of the stub function...
if( myobject != null )
{
myobject.dosomething()
}