当我的应用程序在现场崩溃时,我得到了这种堆栈跟踪,而我无法理解它的实际含义:
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object com.myapp.model.DatabaseObject.a(java.lang.String)' on a null object reference
at com.myapp.video.VideoController.hideControlsAfterDelay$1349ef(VideoController.java)
setVideoView(VideoController.java)
playClip(VideoController.java)
playClipAtIndex(VideoController.java)
playUrl(VideoController.java)
updateDownloadButton(VideoController.java)
stringForTimeOffset(VideoController.java)
handleScrubMove(VideoController.java)
animateShowHide(VideoController.java)
at com.myapp.video.VideoPlayerActivity$2.onLoad(VideoPlayerActivity.java)
at com.myapp.model.Moment$1.onLoad(Moment.java)
onUpdate(Moment.java)
onNeedsUpdate$2cf7ba29(Moment.java)
at com.myapp.model.Moment.notifyListeners(Moment.java)
at com.myapp.model.Moment.getKey(Moment.java)
setValueForKey(Moment.java)
valueForKeyPath(Moment.java)
write(Moment.java)
addClick(Moment.java)
at com.myapp.model.Moment$3.onLoad(Moment.java)
at com.myapp.model.FireDatabaseObject$1.onDataChange(FireDatabaseObject.java)
at com.google.firebase.database.zzp.onDataChange(zzp.java)
at com.google.android.gms.internal.zzegf.zza(zzegf.java)
zzc(zzegf.java)
zzbvp(zzegf.java)
at com.google.android.gms.internal.zzeia.zzbyc(zzeia.java)
at com.google.android.gms.internal.zzeig.run(zzeig.java)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
为什么我会在异常点获得可能的(?)呼叫者列表? 谁试图在空对象上调用com.myapp.model.DatabaseObject.a()?
它是hideControlsAfterDelay $ 1349ef(),setVideoView(),playClip()还是列出的任何其他内容?
因为hideControlsAfterDelay $ 1349ef()根本没有调用com.myapp.model.DatabaseObject.a:
void hideControlsAfterDelay(long delay) {
cancelHideControls();
mHideControlsTimer = new Timer();
mHideControlsTimer.schedule(new TimerTask() {
@Override
public void run() {
if (getActivity() != null) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
animateShowHide(false);
mHideControlsTimer = null;
}
});
}
}
}, delay);
}
对于任何这些方法都一样,那么这里发生了什么?
请注意,我不是在询问空指针异常,我可以处理我的编码错误,我问的是堆栈跟踪的形状:为什么有几种方法列在堆栈跟踪的同一级别?
感谢您对此发光。