Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException: Attempt to invoke virtual... #20

Closed
terhoraj opened this issue Jul 14, 2016 · 6 comments
Closed

java.lang.NullPointerException: Attempt to invoke virtual... #20

terhoraj opened this issue Jul 14, 2016 · 6 comments

Comments

@terhoraj
Copy link

terhoraj commented Jul 14, 2016

After getting rid of "Cannot read property 'uploadservice' of undefined" error I came across following error which is related to:

Attempt to invoke virtual method 'android.content.Intent android.content.text.registerReceiver(anroid.content.BroadcastReceiver, anroid.content.IntentFilter)' on null object reference com.alexbbb.uploadservice.AbstractUploadServiceReceiver.register... and so on...

Any ideas?

I have tried to delete platform via console and by hand, building, running multiple times. The usual stuff.

I'm using newest NativeScript and Android

@PanayotCankov
Copy link
Contributor

I think it is the same problem as #11. The uploadservice should be exposed in JavaScript at the first place.

@Pistos
Copy link

Pistos commented Jul 8, 2019

I'm getting this issue with "nativescript-background-http": "^3.4.1". Console output is:

System.err: Error calling module function
System.err: Error: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent android.content.Context.registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter)' on a null object reference
System.err: net.gotev.uploadservice.UploadServiceBroadcastReceiver.register(UploadServiceBroadcastReceiver.java:86)

@Pistos
Copy link

Pistos commented Jul 8, 2019

Solved my issue: I was calling the nativescript-background-http code too early in the app's execution (in main.js), such that application.android.context was not defined yet, and that was what UploadServiceBroadcastReceiver.java:86 was trying to use.

@geoffbullen
Copy link

Hi @Pistos, I'm getting the same error when I'm calling background-http from within a jasmine test.

Any pointers on what I might need to do to initialise the android context (or whatever) to get past this?

@Pistos
Copy link

Pistos commented Jul 22, 2019

@geoffbullen Sorry, I don't have test coverage of this same code, so I don't have experience that could help you.

@geoffbullen
Copy link

Thanks anyhow @Pistos :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants