-
Notifications
You must be signed in to change notification settings - Fork 177
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
Crash on Android when tapping on camera icon in compose box, in release mode #879
Comments
Interestingly, the crash doesn't occur when ran with |
Initially occured on my personal device, but just tried reproducing it in Emulator (API 34) and it reproduces there too; crash doesn't occur when built with |
Huh interesting, thanks for the report. This definitely used to work. Can you find a previous version where it did work, and then bisect to find what change made it stop working? (I'd guess the relevant change is either in Flutter upstream, or in |
Okay, so Which seems unrelated, but could be something to do with Found an upstream report with similar error message — flutter/flutter#146266 |
Just tested that the crash doesn't occur with updated AGP and other related dependecies, including enabling diff --git a/android/app/build.gradle b/android/app/build.gradle
index dd4178c..4f01760 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -23,9 +23,10 @@ android {
namespace "com.zulip.flutter"
compileSdkVersion flutter.compileSdkVersion
- ndkVersion flutter.ndkVersion
+ ndkVersion '27.0.12077973'
compileOptions {
+ coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
@@ -97,4 +98,5 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
+ coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
}
diff --git a/android/gradle.properties b/android/gradle.properties
index 740bb74..ee5e36e 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -6,11 +6,11 @@ android.enableJetifier=true
# Defining them here makes them available both in
# settings.gradle and in the build.gradle files.
-agpVersion=8.1.4
+agpVersion=8.5.0
# Generally update this to the version found in recent releases
# of Android Studio, as listed in this table:
# https://kotlinlang.org/docs/releases.html#release-details
# A helpful discussion is at:
# https://stackoverflow.com/a/74425347
-kotlinVersion=1.9.10
+kotlinVersion=2.0.10
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 07e42d5..545935f 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -6,7 +6,7 @@
# the wrapper is the one from the new Gradle too.)
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME Alternative (and simpler) fix is to disable R8 fullmode temporarily, but it might affect build sizes: # android/gradle.properties
android.enableR8.fullMode=false Though the root cause still remains unknown, the different AGP release notes doesn't say much — https://developer.android.com/build/releases/past-releases/agp-8-4-0-release-notes. |
Fascinating, thanks. Yeah, presumably the trigger must be something in the package:video_player Android build config. Also interesting that those upgrades fix it. We should probably take them anyway... except that NDK upgrade, where it'd be nice to stick to the one from Flutter upstream. Do things work if you leave that one out? |
Keeping the ndk version to
To avoid this, the above diff updates it to the latest LTS version — Also, interestingly removing the explicit |
Interesting. I wonder what the point is of I guess let's just delete that line, then, and let the NDK version be determined automatically from the other things in the build. And then a PR that does that and the other Android-related upgrades in your diff above would be great. For the branch, please split the different changes into different commits: Gradle, AGP, Kotlin, NDK, coreLibraryDesugaring (in some order). That way they can each have their own commit message pointing to relevant release notes. For example commit messages… You can find more examples in the zulip-mobile repo, with |
Specifying the NDK version here doesn't seem to do us any good. This value provided by the `flutter` tool is currently 23.1.7779620. If we upgrade the Android Gradle plugin (AGP) to 8.5.0, its current latest, then we start getting build warnings: zulip#879 (comment) saying that a bunch of plugins -- including first-party plugins -- are all using NDK 26.1.10909125 instead, and telling us to switch to that. Conversely, if we leave this line out, then the same AGP upgrade causes no warnings and works just fine. So let the version float. This does contradict AGP's own recommendation: https://developer.android.com/studio/projects/configure-agp-ndk which is to use this `ndkVersion` property. But if a bunch of our plugins are going to use a floating version anyway, it doesn't seem helpful to try to hang back. [greg: added commit-message body]
Specifying the NDK version here doesn't seem to do us any good. This value provided by the `flutter` tool is currently 23.1.7779620. If we upgrade the Android Gradle plugin (AGP) to 8.5.0, its current latest, then we start getting build warnings: zulip#879 (comment) saying that a bunch of plugins -- including first-party plugins -- are all using NDK 26.1.10909125 instead, and telling us to switch to that. Conversely, if we leave this line out, then the same AGP upgrade causes no warnings and works just fine. So let the version float. This does contradict AGP's own recommendation: https://developer.android.com/studio/projects/configure-agp-ndk which is to use this `ndkVersion` property. But if a bunch of our plugins are going to use a floating version anyway, it doesn't seem helpful to try to hang back. [greg: added commit-message body]
Release notes: https://developer.android.com/build/releases/past-releases/agp-8-2-0-release-notes https://developer.android.com/build/releases/past-releases/agp-8-3-0-release-notes https://developer.android.com/build/releases/past-releases/agp-8-4-0-release-notes https://developer.android.com/build/releases/gradle-plugin (for 8.5, for now) Some of the release notes (especially 8.2) are very thin; it's not clear if there are other changes that aren't being described, or if they just didn't change much. Changes possibly affecting us: * 8.3 adds "precise resource shrinking", which seems to be an additional form of resource shrinking. * As usual, a new AGP version requires a new Android Studio version. AGP 8.5 requires Android Studio Koala. [greg: added reading of release notes] Fixes: zulip#879
Also updated that upstream issue (flutter/flutter#146266 (comment)) with our findings here. In particular it doesn't look like it was previously known on that issue thread that an AGP upgrade resolves it, so that should be helpful for other people hitting the issue. |
Release notes: https://developer.android.com/build/releases/past-releases/agp-8-2-0-release-notes https://developer.android.com/build/releases/past-releases/agp-8-3-0-release-notes https://developer.android.com/build/releases/past-releases/agp-8-4-0-release-notes https://developer.android.com/build/releases/gradle-plugin (for 8.5, for now) Some of the release notes (especially 8.2) are very thin; it's not clear if there are other changes that aren't being described, or if they just didn't change much. Changes possibly affecting us: * 8.3 adds "precise resource shrinking", which seems to be an additional form of resource shrinking. * As usual, a new AGP version requires a new Android Studio version. AGP 8.5 requires Android Studio Koala. [greg: added reading of release notes] Fixes: zulip#879
Specifying the NDK version here doesn't seem to do us any good. This value provided by the `flutter` tool is currently 23.1.7779620. If we upgrade the Android Gradle plugin (AGP) to 8.5.2, its current latest, then we start getting build warnings: zulip#879 (comment) saying that a bunch of plugins -- including first-party plugins -- are all using NDK 26.1.10909125 instead, and telling us to switch to that. Conversely, if we leave this line out, then the same AGP upgrade causes no warnings and works just fine. So let the version float. This does contradict AGP's own recommendation: https://developer.android.com/studio/projects/configure-agp-ndk which is to use this `ndkVersion` property. But if a bunch of our plugins are going to use a floating version anyway, it doesn't seem helpful to try to hang back. [greg: added commit-message body]
Logs:
The text was updated successfully, but these errors were encountered: