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

I cannot publish my app :( Sentry does not capture crashes, and my app gets rejected again and again by app stores #548

Closed
4 of 11 tasks
fzyzcjy opened this issue Aug 12, 2021 · 19 comments

Comments

@fzyzcjy
Copy link
Contributor

fzyzcjy commented Aug 12, 2021

Platform:

  • Dart
  • Flutter Android or iOS
  • Flutter Web

IDE:

  • VSCode
  • IntelliJ/AS
  • XCode
  • Other, which one?

split-debug-info and obfuscate (Flutter Android or iOS) or CanvasKit (Flutter Web):

  • Enabled
  • Disabled

Platform installed with:

  • pub.dev
  • GitHub

Output of the command flutter doctor -v below:

[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.15.7 19H1323 darwin-x64, locale zh-Hans-CN)
    • Flutter version 2.2.3 at /Users/tom/opt/flutter
    • Framework revision f4abaa0735 (6 周前), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/tom/Library/Android/sdk
    • Platform android-30, build-tools 29.0.3
    • ANDROID_SDK_ROOT = /Users/tom/Library/Android/sdk
    • Java binary at: /Users/tom/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2)
    • Android Studio at /Users/tom/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.3)
    • IntelliJ at /Users/tom/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.59.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.25.0

[✓] Connected device (3 available)

The version of the SDK (See pubspec.lock):
5.0.0


I have the following issue:

Hi, thanks for the lib! When I publish my app to an Android app store, the reviewers rejected my app, saying that: "the app fails to start". They also provide a (almost useless) screenshot, showing the android system homepage, indicating that they tapped the app icon and it fails to start.

However, I see completely nothing in my sentry webpage. Originally, sentry works pretty well - it captures many Flutter (Dart) exceptions, many Android (Java) exception and so on. But this time it fails.

If this is a rare bug I can tolerate it. However, that Android app store has rejected my app several times, every time saying that it crashes! But I really have zero evidence on what bug it is indeed, because I cannot get any stack trace, neither can I get any logs.

Any help is appreciated!

Steps to reproduce:

  • see above

Actual result:

  • see above

Expected result:

  • see above
@bruno-garcia
Copy link
Member

I can imagine this is very frustrating. There's a possibility that sentry isn't capturing an error if you are using the flutter sdk if that error happened even before flutter engine starts. That's because the init code is written in Dart and from there, with method channels, we init the Android (java/ndk) bits.

I suggest you init the Android sdk programmatically in this case even before the Dart layer. And ensure the app is restarted after the crash so the sdk is able to capture the error before it crashes again.

Besides that, I suggest getting more info like what device are they using so you can repro the issue.

@marandaneto
Copy link
Contributor

sorry about that, but indeed, more information here would be very useful, like OS version, device brand, and model, etc.
we've run E2E tests in a few device farms a few months ago and everything worked as expected, obviously, we can't test it for every device since Android is very fragmented.

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 12, 2021

@bruno-garcia @marandaneto Hi thanks for your replies!

I suggest you init the Android sdk programmatically in this case even before the Dart layer.

Good idea. How should i do it? IMHO sentry flutter uses sentry android to send out those envelopes (if I remember correctly). So if I init sentry android manually and forbid sentry flutter to communicate with sentry android then it may have problems?

more information here would be very useful, like OS version, device brand, and model, etc.

brand: huawei
model: Mate 30

@marandaneto
Copy link
Contributor

@fzyzcjy follow #265

also wondering if this could be related to #443

do you know the OS version as well? thanks

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 12, 2021

@marandaneto I will follow that; the issue seems to be still open...

For that phone I do not know. But let me report another two series of phones that fails in the reviewer's eyes:

a. honor changwan 7, DUA-AL00, android 8.1.0
b. huawei changxiang 10e, android 10 https://zh.wikipedia.org/zh-hk/%E5%8D%8E%E4%B8%BA%E7%95%85%E4%BA%AB10e

@ueman
Copy link
Collaborator

ueman commented Aug 12, 2021

Does the Google Play Developer Console catch the error? Maybe there's something useful. @marandaneto can you also check that for the Sentry app in the Google Play developer console?

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 12, 2021

@ueman No, in my country, people cannot use Google...

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 12, 2021

I see an error (not by sentry, but by other cloud platforms). not sure whether this is the one that makes the reviewer reject my app, but definitely sentry does not (and cannot) capture.

So... starting sentry BEFORE flutter starts is really helpful! making it the default case will be very helpful for everyone!

one flutter android plugin throws exception in onAttachedToEngine.

java.lang.RuntimeException: Unable to start activity ComponentInfo{......}: java.lang.IllegalStateException: sensorManager.getDefaultSensor(sensorType) must not be null
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3895)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4074)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2473)
	at android.os.Handler.dispatchMessage(Handler.java:110)
	at android.os.Looper.loop(Looper.java:219)
	at android.app.ActivityThread.main(ActivityThread.java:8347)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
Caused by: java.lang.IllegalStateException: sensorManager.getDefaultSensor(sensorType) must not be null
	at e.n.e.a.<init>(SourceFile:2)
	at e.n.e.b.a(SourceFile:5)
	at e.n.e.b.onAttachedToEngine(SourceFile:2)
	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.add(SourceFile:5)
	at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(SourceFile:28)
	at com.cjy.yplusplus.MainActivity.configureFlutterEngine(SourceFile:1)
	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(SourceFile:8)
	at io.flutter.embedding.android.FlutterActivity.onCreate(SourceFile:4)
	at android.app.Activity.performCreate(Activity.java:8085)
	at android.app.Activity.performCreate(Activity.java:8073)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1320)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3868)
	... 11 more

@marandaneto
Copy link
Contributor

@fzyzcjy indeed, the problem is that Flutter inits itself (before everything), is there a way to opt-out the auto init. of the Flutter engine? afaik Flutter inits by a ContentProvider and the priority is defined at runtime which is kinda random sometimes.

@marandaneto
Copy link
Contributor

yes #265 is open and still requires improvements/documenting the right way on how to do it which is not that straightforward since the init. order is kinda problematic with ContentProvider

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 12, 2021

@marandaneto So... how can I init sentry android before flutter? I am not a android professonal (but much more experienced in flutter), so not very familiar with the android stuff

@ueman
Copy link
Collaborator

ueman commented Aug 12, 2021

@fzyzcjy indeed, the problem is that Flutter inits itself (before everything), is there a way to opt-out the auto init. of the Flutter engine? afaik Flutter inits by a ContentProvider and the priority is defined at runtime which is kinda random sometimes.

Isn't this the solution for it? Well unless the Flutter ContentProvider uses int.max 😅

Do you have a source for the Flutter ContentProvider claim? I wasn't able to find it and like to read up on it.

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 13, 2021

@ueman +1

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 13, 2021

@ueman @marandaneto IMHO, I wonder why cannot we put sentry android's init in MyApplication.onCreate? Like what official doc says: https://docs.sentry.io/platforms/android/configuration/manual-init/

Or, can we directly use the automatic way mentioned in https://docs.sentry.io/platforms/android/ ?

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 13, 2021

@ueman @marandaneto Another approach I come up with: Look at the implementation of https://pub.dev/packages/flutter_sentry , we can see that it seem to initialize android, ios, flutter individually.

@fzyzcjy
Copy link
Contributor Author

fzyzcjy commented Aug 13, 2021

By the way, this cause (#548 (comment)) shows that, though not frequent, such bug can happen because of any flutter package (with android code) that an app uses.

Thus, what @bruno-garcia says that's very unlikely and would probably mean a bug in Flutter itself at #255 (reply in thread) may not be complete ;)

@ueman
Copy link
Collaborator

ueman commented Aug 13, 2021

@ueman @marandaneto IMHO, I wonder why cannot we put sentry android's init in MyApplication.onCreate? Like what official doc says: https://docs.sentry.io/platforms/android/configuration/manual-init/

The Application class is created after ContentProviders, so it wouldn't help in this case.

Or, can we directly use the automatic way mentioned in https://docs.sentry.io/platforms/android/ ?

Could be worth a try. However I believe the Android Sentry configuration is overridden as soon as Sentry Flutter is initialized. I haven't tested it yet though. @marandaneto has probably a better insight on this than me.

@marandaneto
Copy link
Contributor

we still need to figure out the best way and all the corner cases, that's why the issue remains open, unfortunately, I don't have the answers right now, but all the mentioned points here are valid used cases and will be taken into consideration, a few of them were already discussed across some other issues.

@bruno-garcia bruno-garcia added this to To do in kanban via automation Aug 25, 2021
@bruno-garcia bruno-garcia added this to Backlog in Mobile Platform Team Archived via automation Aug 25, 2021
@bruno-garcia bruno-garcia moved this from Backlog to Needs Discussion in Mobile Platform Team Archived Aug 25, 2021
@bruno-garcia bruno-garcia moved this from Needs Discussion to Next in Mobile Platform Team Archived Sep 15, 2021
@marandaneto
Copy link
Contributor

Closing in favor of #265

kanban automation moved this from To do to Done Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

5 participants