alibaba / alibaba/flutter_boost

崩溃!

Open
#946 3 comments 0 reactions 0 assignees View on GitHub
Android
Dominant language
Dart
Stars
7.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

自建异常捕获信息如下
Caused by: com.XXX.flutter.crash.FlutterException: PlatformException(error, Attempt to invoke virtual method 'android.view.Window android.app.Activity.getWindow()' on a null object reference, null)
2at @. (:149)
3at @. MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156)
4at @. HapticFeedback.mediumImpact (package:flutter/src/services/haptic_feedback.dart:52)

代码位置如下:
private void playSystemSound(SoundType soundType) {
if (soundType == SoundType.CLICK) {
View view = this.activity.getWindow().getDecorView();
view.playSoundEffect(0);
}
}

this.activity.getWindow().getDecorView();
activity 为空导致大量崩溃。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the playSystemSound method shown in the issue and trace how this.activity is initialized and used during Flutter haptic or system-sound calls. Confirm the lifecycle path that leaves the activity null and define done as preventing the reported null dereference without breaking sound feedback; the payload names no file or regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.