Fix Missing DynamiteApplicationContext after GmsCore package rename#290
Fix Missing DynamiteApplicationContext after GmsCore package rename#290zappybiby wants to merge 2 commits intoReVanced:mainfrom
Conversation
98399d1 to
40725e4
Compare
|
This fixes the YT Music Android Auto crash, it now shows "Now playing" and forward/back track buttons on car now correctly work. Playlists do not show at all, looking into it. |
|
Is this something that should be in GmsCore upstream instead? |
|
Thanks for the PR! I think so far playlist have never showed up in Android Auto at all, weirdly only podcast? But showing Playlist and Homescreen would be the ultimate thing still missing. |
40725e4 to
cdf9cf9
Compare
|
Ok I was just making sure I didn't cause a regression, I couldn't remember what displayed originally. I just narrowed the scope of the PR to the minimum patches needed. I'm doing a few more tests to make sure things are working okay, doing another bug report dump. |
Shouldnt the patched app simply be adjusted to request under the new package name instead of modifying GmsCore? I am not sure what exactly goes wrong though and also why the new version of GmsCore regressed here |
Revanced patch does rewrite app-side references but it cannot fix these internal GmsCore runtime lookup paths. The failing logic is in GmsCore runtime context/module loading paths As far as I can tell, the root cause comes from the GmsCore runtime, and a app-specific workaround Revanced patch for an internal runtime resolver bug wouldn't be the right solution. |
|
I understand. Now the follow-up question would be, why did this issue not appear previously? Such a fix was not present in previous GmsCore versions |
The regression stems from ReVanced rename work (e6cd248) setting runtime package to
Before Before e6cd248 RenameAfter Rename (e6cd248 regression)After this proposed fixAnd if a future commit changes applicationId again, generated BuildConfig.APPLICATION_ID changes automatically. |
But so did our older fork of GmsCore, but still the issue did not appear. We renamed the package, permissions, authorities and even beyond that a couple more things that were not necessary. So something must have changed. |
|
I tested this on android auto on my car and worked fine, no crashes. Thanks a lot for the fix! |
|
@zappybiby #290 (comment) got an answer for this? |
I did look at both git history of Revanced patches including things like gmscore / Android Auto related commits.
What did change recently with runtime:
I believe the root cause for this specific problem stemmed from the recent renaming commit. I tested once more tonight and there are no crashes when connecting to AA and I am not seeing any of those errors in the logs. |
|
I may have to look into Constants.GMS_PACKAGE_NAME then. If its used for internal code thats not related to package name or the renamed stuff, we may have to create a new constant for the renamed package name. Its not unlikely other internal code could depend on this constant being the original gms. Also, it looks like announcements stopped working with the latest changes, but perhaps this PR also fixes that? Do you receive announcements from say youtube? |
Summary
This PR addresses an Android Auto crash loop when connecting to ReVanced YouTube Music.
During Android Auto media binding, YouTube Music repeatedly crashes with:
java.lang.IllegalStateException: Missing DynamiteApplicationContext.The failure occurs in the GmsCore Dynamite
googlecertificatespath and breaks Android Auto media integration (spinner / no controls / no artwork), while playback may still continue.Problem
When Android Auto binds
com.google.android.apps.youtube.music.mediabrowser.MusicBrowserService, the app crashes in this chain:com.google.android.gms.common.GoogleCertificatesImpljava.lang.IllegalStateException: Missing DynamiteApplicationContextcom.google.android.apps.youtube.music.mediabrowser.MusicBrowserService.e(PG:137)Android Auto then loses the media browser connection and repeatedly retries/restarts the service.
Regression source
The regression was introduced by the package rename work:
e6cd2487(same logical change also appears asc778936c):feat: Allow side-by-side installation with Google services by renaming permissions and authoritiesWhat changed in that commit
play-services-core/build.gradle:122applicationId = "app.revanced.android.gms"play-services-core/build.gradle:134resValue "string", "package_id", "app.revanced.android.gms"Why this caused the crash
After that rename, some runtime code paths still resolved remote/dynamite context using only the old package assumption (
com.google.android.gms), which can produce an invalid module context under renamed GmsCore.Pre-fix examples:
play-services-core/src/main/java/com/google/android/gms/chimera/DynamiteContextFactory.java(pre-fix line 52)originalContext.createPackageContext(Constants.GMS_PACKAGE_NAME, 0);play-services-base/src/main/java/com/google/android/gms/common/GooglePlayServicesUtil.java(pre-fix lines 140, 153)createPackageContext(Constants.GMS_PACKAGE_NAME, ...)getResourcesForApplication(Constants.GMS_PACKAGE_NAME)When Android Auto triggers YT Music media-browser startup, this mismatch appears in the
googlecertificatesDynamite path and terminates with:java.lang.IllegalStateException: Missing DynamiteApplicationContext.Environment
SM-S926U(e2q)16(SDK36)2026-01-01samsung/e2qsqw/e2q:16/BP2A.250605.031.A3/S926USQS4CZA1:user/release-keyscom.google.android.projection.gearhead16.1.660414-release(versionCode=161660414)8.10.52(versionCode=81052240)0.3.13.2.250932(versionCode=250932004)2026-02-18 20:34:18Evidence
1) Crash loop in YT Music media browser startup
Full stacktrace (raw)
2) Dynamite
googlecertificatescontext created immediately before crash3) Android Auto is actively binding YT Music media service
4) Additional service/module warnings seen during the same window
Proposed fixes in this PR
d2ec2657-fix(chimera): resolve package context for renamed GmsCoreDynamiteContextFactoryso it no longer assumes a single package name when creating the GMS package context.cdf9cf92-fix(context): resolve renamed GmsCore package in remote contextsGooglePlayServicesUtilto try renamed (app.revanced.android.gms) and stock (com.google.android.gms) package candidates instead of one hardcoded package.