-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Release runtime error when upgrading from 8.9.0 to 8.12.0 without updating io.sentry.android.gradle #2544
Comments
There is another issue here in sentry-java which seems to be related, but refers to different versions, and is closed |
Are you overriding the sentry-flutter plugin dependency on |
I don't believe so. This is my top level build.gradle:
And settings.gradle
This is the plugins block at the top of my app build.gradle:
|
I've had a look at the sentry-android-gradle-plugin and it looks like it's adding a dependency on sentry-nadroid by itself, with a version specified in the plugin. This does not work with Flutter because there are internal APIs exposed from the native SDK (sentry-android) to the Flutter SDK (sentry-flutter) and there are breaking changes made between minor versions, since these APIs are only internal and we depend on an exact version here in the flutter SDK. In other words, each Sentry Flutter SDK version requires an exact version of the native SDK, specified in specified I'd have expected the dependency constraint in sentry-flutter SDK would prevent a build if a different version is specified in the app but my Gradle knowledge is spotty. |
this particular issue was an oversight from our side (should've been a major bump since we removed a public API method), but we call it out now to align versions of sentry-android and integrations to the same one to resolve it. In general we should recommend disabling auto-installation when the gradle plugin is used for the hybrid SDKs case, like we do in the React Native docs, to avoid this situation altogether. Alternatively we could try to set up gradle dependency constraints for the sentry-android dependency. |
yup we need to document this better in the flutter docs |
Setting up a dependency constraint, or specifying the dependency as a [strict version] (https://docs.gradle.org/current/userguide/dependency_versions.html#sec:strict-version) in the flutter SDK sounds like a useful thing to avoid these issues (I remember responding to another similar issue with an android native version mismatch, recently). Any ideas why that could be problematic/breaking for some users (with no workaround)? |
Platform
Flutter Mobile Android
Obfuscation
Disabled
Debug Info
Disabled
Doctor
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.1 24B2083 darwin-arm64, locale en-GB)
• Flutter version 3.24.3 on channel stable at /Users/james/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (4 months ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/james/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.14.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.3)
• Android Studio at /Applications/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 17.0.10+0-17.0.10b1087.21-11572160)
[✓] VS Code (version 1.96.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.1 24B2083
darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.1 24B2083
darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome
131.0.6778.205
! Error: Browsing on the local area network for Test user’s Apple Watch. Ensure the device is
unlocked and discoverable via Bluetooth. (code -27)
! Error: Browsing on the local area network for Test user’s iPhone. Ensure the device is unlocked
and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• All expected network resources are available.
• No issues found!
Version
8.12.0
Steps to Reproduce
sentry_flutter: ^8.9.0
to pubspec.yamlid "io.sentry.android.gradle" version "4.11.0"
to theplugins
section of app build.gradleSentryFlutter.init
on app startupsentry_flutter
to 8.12.0 in pubspec.yaml, but do not upgradeio.sentry.android.gradle
Note that I have not tested which specific version of 'sentry_flutter' is the problem, it could be any version between 8.9.0 and 8.12.0 - sorry I don't have time to investigate this further today
Expected Result
I'm guessing this is due to some incompatibility between
flutter_sentry
and the Gradle plugin. Ideally this should fail to compile (I'm not sure if that would be possible?), or provide some kind of compile time warning, or failing that a more informative error message. Also, I think there needs to be some kind of breaking change note in the change log on pub.dev. It's quite a nasty one because, for me, it only appeared in my release build, not debug build, so I ended up shipping a broken app to beta testers.Actual Result
A runtime error in release mode which breaks the app, resulting in blank screen on startup - see below. Strangely, reverting
flutter_sentry
back to 8.9.0 followed by aflutter clean
and rebuild did not seem to resolve the error. Upgrading the Gradle plugin to 4.14.1 did resolve the error.Are you willing to submit a PR?
None
The text was updated successfully, but these errors were encountered: