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

NPE at getPackage().getName() #131

Closed
CameliaTripon opened this issue Jul 25, 2018 · 4 comments
Closed

NPE at getPackage().getName() #131

CameliaTripon opened this issue Jul 25, 2018 · 4 comments

Comments

@CameliaTripon
Copy link

CameliaTripon commented Jul 25, 2018

Describe the bug
We are getting a NullPointerException in onInitializeAccessibilityNodeInfo line 937 because getPackage() is null

Stack trace

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Package.getName()' on a null object reference
	at hwg$d$a.onInitializeAccessibilityNodeInfo(hwg.java:937)
	at android.view.View.onInitializeAccessibilityNodeInfo(View.java:6082)
	at android.view.View.createAccessibilityNodeInfoInternal(View.java:6043)
	at android.view.View$AccessibilityDelegate.createAccessibilityNodeInfo(View.java:22287)
	at android.view.View.createAccessibilityNodeInfo(View.java:6026)
	at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:145)
	at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:119)
	at android.view.View.onInitializeAccessibilityEventInternal(View.java:5980)
	at android.view.View$AccessibilityDelegate.onInitializeAccessibilityEvent(View.java:22199)
	at android.view.View.onInitializeAccessibilityEvent(View.java:5966)
	at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:5833)
	at android.view.View$AccessibilityDelegate.sendAccessibilityEventUnchecked(View.java:22138)
	at android.view.View.sendAccessibilityEventUnchecked(View.java:5816)
	at android.view.View.sendAccessibilityEventInternal(View.java:5795)
	at android.view.View$AccessibilityDelegate.sendAccessibilityEvent(View.java:22096)
	at android.view.View.sendAccessibilityEvent(View.java:5760)
	at hwg$11.onAnimationEnd(hwg.java:531)
	at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
	at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:766)
	at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
	at android.view.Choreographer.doCallbacks(Choreographer.java:670)
	at android.view.Choreographer.doFrame(Choreographer.java:603)
	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:5417)
	at java.lang.reflect.Method.invoke(Method.java)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Smartphone (please complete the following information):

  • Device: Nexus 5
  • OS: Android 6.0.1, API 23
  • Library version 2.12.0

Additional context
It may be caused by the obfuscation...

@sjwall
Copy link
Owner

sjwall commented Jul 25, 2018

Looks like this line in MaterialTapTargetPrompt.java

info.setPackageName(PromptView.this.getClass().getPackage().getName());

This does look like obfuscation

Going on the JavaDoc getPackage() returns null if no package information is available from the archive or codebase. Obfuscation could be removing it or the class loader isn't finding it for another reason

I will add a check for package being null. When it is null the default value for the contexts package will be used

@sjwall
Copy link
Owner

sjwall commented Jul 25, 2018

Changes have been released in v2.12.1, please let me know if these changes resolve this

@CameliaTripon
Copy link
Author

CameliaTripon commented Jul 26, 2018

Thank you for the quick fix. This should solve the issue.
And btw, really nice library

@sjwall
Copy link
Owner

sjwall commented Jul 26, 2018

Thanks @CameliaTripon
Let me know if it doesn't fix it

@sjwall sjwall closed this as completed Jul 26, 2018
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

2 participants