android: Determine default config dir and lower minSdk - #46142
Merged
Conversation
Android 33+ sets the TMPDIR environment variable, but on older versions it's unset. This leads to a crash on older android versions where the fallback is outside the app sandbox (/data/local/tmp). This allows us to lower the minSdk version. I tested with a Pixel 4 emulator API-29, and servoshell seems to work fine. According to https://apilevels.com/ API-29 covers 91% of devices, so it seems reasonable to lower the api level to this for now. After we add emulator testing to CI, we could lower this further. Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
jschwe
force-pushed
the
android_crash_investigation2
branch
from
July 1, 2026 07:38
1f32266 to
dcf7432
Compare
Member
Author
|
Note: I'm pretty unfamiliar with JNI in general, so ideally someone more familiar with JNI reviews this, perhaps @mukilan? |
Member
Author
|
CC @yezhizhen I only tested on emulator, but you have a real android 12 device, right? |
mrobinson
approved these changes
Jul 1, 2026
|
🔨 Triggering try run (#28505114509) for Android |
|
✨ Try run (#28505114509) succeeded. |
yezhizhen
approved these changes
Jul 1, 2026
Member
There was a problem hiding this comment.
CC @yezhizhen I only tested on emulator, but you have a real android 12 device, right?
Now works on my specific device that used to crash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Android 33+ sets the TMPDIR environment variable, but on older versions it's unset. This leads to a crash on older android versions where the fallback is outside the app sandbox (/data/local/tmp).
This allows us to lower the minSdk version and probably the default config directory should never have been TMPDIR in the first place, since that's not persistent.
I tested with a Pixel 4 emulator API-29, and servoshell seems to work fine. However, our current build system uses API-30 NDK, so for now we just restore API-30 support. A follow-up PR could choose a lower NDK version, and thus lower our minSDK version further. But ideally we add CI testing first.
This PR effectively reverts #46104 and fixes the crash on older devices.
Testing: We don't have automatic tests for android in CI.
Fixes: #46115