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

Attempt to invoke virtual method '…' on a null object reference #82

Closed
akahnn opened this issue Apr 9, 2019 · 4 comments
Closed

Attempt to invoke virtual method '…' on a null object reference #82

akahnn opened this issue Apr 9, 2019 · 4 comments
Labels

Comments

@akahnn
Copy link

akahnn commented Apr 9, 2019

Android Activity is null when initSDK is called. Tried placing initSDK in diff entry points in the app, same error. Is there a file you recommend initializing Appsflyer from?

Screen Shot 2019-03-23 at 4 08 59 PM

@aminosman
Copy link

To expand a bit here it seems as though getCurrentActivity() will sometimes return null (if there is no activity). The tricky part here is that this is not consistent reproducible behavior. In development getCurrentActivity was returning the current activity but when we launched to production we started getting exceptions. I see this was added in order to call setPluginDeepLinkData which I am not able to find the purpose of in any documentation (including the android SDK). https://github.com/AppsFlyerSDK/react-native-appsflyer/blob/77d0fb90e1a004642a0b959bf04bac1cbd539763/android/src/main/java/com/appsflyer/reactnative/RNAppsFlyerModule.java#L151

This was added by @af-fess on Feb 7th.

What should happen is there should be a check for a null getCurrentActivity but that would prevent setPluginDeepLinkData from getting called so some refactoring will be needed to ensure this called if it is critical. Any thoughts or insight would be greatly appreciated.

@pqkluan
Copy link

pqkluan commented May 7, 2019

@aminosman That not the only place missing the null check, there are new errors appear on production after I patch the above null check:

Attempt to invoke virtual method 'android.content.Context android.app.Activity.getBaseContext()' on a null object reference

and

Attempt to invoke virtual method 'android.content.Context android.content.ContextWrapper.getBaseContext()' on a null object reference

@SpertsyanKM
Copy link

Any solutions? Having the same issue.

@wesfieldj wesfieldj added the bug label Jul 3, 2019
@wesfieldj
Copy link
Contributor

The issue was fixed.

See - 64332f0

Thanks for your help!

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

No branches or pull requests

5 participants