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

bug(YouTube - Theme): Android 8.0 dark mode startup crash #4536

Closed
3 tasks done
bitingsock opened this issue Mar 4, 2025 · 31 comments · Fixed by #4540
Closed
3 tasks done

bug(YouTube - Theme): Android 8.0 dark mode startup crash #4536

bitingsock opened this issue Mar 4, 2025 · 31 comments · Fixed by #4540
Labels
Bug report Something isn't working

Comments

@bitingsock
Copy link

bitingsock commented Mar 4, 2025

Bug description

App immediately crashes at launch, before showing anything.

Error logs

03-04 04:44:07.055 32215 32215 D AndroidRuntime: Shutting down VM
03-04 04:44:07.059 32215 32215 E AndroidRuntime: FATAL EXCEPTION: main
03-04 04:44:07.059 32215 32215 E AndroidRuntime: Process: app.revanced.android.youtube, PID: 32215
03-04 04:44:07.059 32215 32215 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{app.revanced.android.youtube/com.google.android.apps.youtube.app.watchwhile.MainActivity}: android.view.InflateException: Binary XML file line #4: Binary XML file line #2: Error inflating class <unknown>
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3116)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3259)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1950)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7073)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #4: Binary XML file line #2: Error inflating class <unknown>
03-04 04:44:07.059 32215 32215 E AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
03-04 04:44:07.059 32215 32215 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at java.lang.reflect.Constructor.newInstance0(Native Method)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.LayoutInflater.createView(LayoutInflater.java:647)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.LayoutInflater.parseInclude(LayoutInflater.java:965)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.LayoutInflater.rInflate(LayoutInflater.java:859)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at nsd.o(PG:69)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at fxs.k(PG:387)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at fxs.a(PG:90)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at bbpd.e(PG:12)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at bbpd.a(PG:7)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at fxs.l(PG:40)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at fxs.a(PG:85)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at bbpd.e(PG:12)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at bbpd.a(PG:7)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at fxs.b(PG:30)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at fxs.a(PG:100)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at bbpd.e(PG:12)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at bbpd.a(PG:7)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at fxu.b(PG:12)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at fxu.a(PG:3026)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at bbpd.e(PG:12)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at bbpd.a(PG:7)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at com.google.android.apps.youtube.app.watchwhile.MainActivity.onCreate(PG:1625)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:7327)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:7318)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3096)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3259)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1950)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7073)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f040a25 a=-1}
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:946)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.content.res.TypedArray.getDrawable(TypedArray.java:930)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.View.<init>(View.java:5452)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.view.ViewGroup.<init>(ViewGroup.java:660)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.widget.FrameLayout.<init>(FrameLayout.java:92)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.widget.FrameLayout.<init>(FrameLayout.java:87)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at android.widget.FrameLayout.<init>(FrameLayout.java:82)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at mty.<init>(PG:4)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	at com.google.android.apps.youtube.app.ui.swipetocontainer.SwipeToContainerFrameLayout.<init>(PG:4)
03-04 04:44:07.059 32215 32215 E AndroidRuntime: 	... 43 more

Solution

No response

Additional context

microg installed
patch for non-root succeeded, built, and installed with both CLI v5.0.0 and v5.0.1-dev.1
using patches-v5.13.0.rvp and patches-v5.12.0.rvp against youtube-v19.47.53 and v19.46.42

-jar cli.jar patch -p patches.rvp --out=out1.apk yt.apk

Acknowledgements

  • I have checked all open and closed bug reports and this is not a duplicate.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
@bitingsock bitingsock added the Bug report Something isn't working label Mar 4, 2025
@oSumAtrIX
Copy link
Member

You are patching and installing a split apk. Splits can only be mounted.

@oSumAtrIX oSumAtrIX closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2025
@bitingsock
Copy link
Author

@bitingsock
Copy link
Author

I also tried with the manager to the same result

@oSumAtrIX
Copy link
Member

I also tried with the manager to the same result

Follow these steps and report back

@bitingsock
Copy link
Author

bitingsock commented Mar 4, 2025

Here are the results. I edited out the long processes with no visual changes.
the patched apk was removed and the above apk was reinstalled prior to this
https://github.com/bitingsock/fileRef/raw/refs/heads/main/yt.mkv

@LisoUseInAIKyrios
Copy link
Contributor

The crash is coming from YouTube code. Does unpatched 19.47.53 work? Are you using an emulator or an oddball device?

Also try patching 19.16.39.

@oSumAtrIX
Copy link
Member

Here are the results. I edited out the long processes with no visual changes. the patched apk was removed and the above apk was reinstalled prior to this bitingsock/fileRef@refs/heads/main/yt.mkv (raw)

You selected the installed app, which can be a split APK. Select a full APK from storage, or install it beforehand.

@bitingsock
Copy link
Author

Here are the results. I edited out the long processes with no visual changes. the patched apk was removed and the above apk was reinstalled prior to this bitingsock/fileRef@refs/heads/main/yt.mkv (raw)

You selected the installed app, which can be a split APK. Select a full APK from storage, or install it beforehand.

the installed app was from the above apk saved in storage. it launches correctly when unpatched:

Image

The crash is coming from YouTube code. Does unpatched 19.47.53 work? Are you using an emulator or an oddball device?

It's a galaxy note 8, just being mirrored with scrcpy. behaves the same with and without it.

Also try patching 19.16.39.

here is the log for a patched 19.16.39
log.txt

@LisoUseInAIKyrios
Copy link
Contributor

the installed app was from the above apk saved in storage.

But the video you posted shows you selected the app from the installed apps, which can cause issues if not using root install. You should use the 'storage' button at the bottom of the screen.

@bitingsock
Copy link
Author

the installed app was from the above apk saved in storage.

But the video you posted shows you selected the app from the installed apps, which can cause issues if not using root install. You should use the 'storage' button at the bottom of the screen.

I did that way and produces the same:

log.txt

@bitingsock
Copy link
Author

also, the patch for 19.16.39 did warn:
WARNING: "Open videos fullscreen" incompatible with com.google.android.youtube 19.16.39 but compatible with com.google.android.youtube 19.46.42, 19.47.53

@LisoUseInAIKyrios
Copy link
Contributor

That patch is not compatible with 19.16.39, which is expected.

The error log still makes no sense. it shows a crash coming from YouTube code.

Try patching with only GmsCore support.

@bitingsock
Copy link
Author

bitingsock commented Mar 4, 2025

I'll mention that 19.16.39 does at least show the youtube logo before crashing. and it looks like I used patch 5.12.0 on that previously, here is 5.13.0, not that it looks any different to me

log.txt

-jar cli.jar patch -p patches.rvp --exclusive -e "GmsCore support" --out=out1.apk yt19.47.53.apk
does produce a functional install, app settings confirms ReVanced is applied

@LisoUseInAIKyrios
Copy link
Contributor

If only GmsCore support works, then keep repatching with more patches until the issue returns. Use binary search to speed up repatching.

Report back which patch causes the issue.

@bitingsock
Copy link
Author

Use binary search to speed up repatching.

I'm unfamiliar, can you point me to a resource? otherwise I was just going to make a shell for loop that compiles them all individually

@Ushie
Copy link
Member

Ushie commented Mar 4, 2025

Image

@bitingsock
Copy link
Author

Image

gotcha, ezpz

@bitingsock
Copy link
Author

bitingsock commented Mar 4, 2025

I've identified

Index: 185
Name: Theme
Description: Adds options for theming and applies a custom background theme (dark background theme defaults to amoled black).
Enabled: true
Options:
Title: Dark theme background color

as a culprit. applying just theme and gms support causes a crash.
switching night mode off seems to fix it and let it launch. turning it back on maintains functional behavior

@LisoUseInAIKyrios
Copy link
Contributor

Are you using any patch options?

It might be related to #2811

@bitingsock
Copy link
Author

bitingsock commented Mar 4, 2025

Are you using any patch options?

It might be related to #2811

my full command is:
-jar cli.jar patch -p patches.rvp --exclusive --ei 185 -e "GmsCore support" --out=out1.apk yt19.47.53.apk

@bitingsock
Copy link
Author

bitingsock commented Mar 4, 2025

I've confirmed a workaround for me. after installing, the app must be run without night mode on at least once. then the app launches normally. using full default patches:
-jar cli.jar patch -p patches.rvp --out=out.apk yt19.47.53.apk

@oSumAtrIX
Copy link
Member

Can you reproduce the bug now again? What if you clear app data?

@bitingsock
Copy link
Author

yes, if I clear the youtube app data it bugs again until I turn off night mode.

@oSumAtrIX
Copy link
Member

In this case we need to debug the patch and see what specifically in there breaks the app. Alternatively, you could try using older patches and see when the bug was introduced, narrowing down the exact release that introduced the patch

@oSumAtrIX oSumAtrIX reopened this Mar 4, 2025
@bitingsock
Copy link
Author

try using older patches and see when the bug was introduced

I'll try that. otherwise, how effective is debugging without root?

@oSumAtrIX
Copy link
Member

Fairly, but not efficient. We'd need to build the patches with some changes and see if they fix your issue. I'd like to do that if using older patches doesn't work. In that case please reach out to [email protected] for further instructions.

@bitingsock
Copy link
Author

this release is the regression:
https://github.com/ReVanced/revanced-patches/releases/tag/v5.7.1-dev.2
with this commit:
0240efe

@LisoUseInAIKyrios
Copy link
Contributor

this commit: 0240efe

That commit fixed the status bar not using the splash screen dark theme color.

Need to compare the XML files it's modifying and see the changes before/after patching. It might be modifying XML attributes it should not be.

@bitingsock
Copy link
Author

I think this is the temp file after patching: ".\out1-temporary-files\patcher\apk\res\values-night\styles.xml"

styles.txt

I can't seem to find where it is or what it looks like prior

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Mar 9, 2025

The change that caused the issue was to fix #4160

I reverted that fix and instead modified the prior design with 741c2d5

The status and nav bar white color issue is still fixed, but I cannot verify the app crash because the Android 8.0 emulator does not support app dark mode. Android 9 natively supports dark mode but does not crash. The issue must be specific to Samsung Android 8.0 dark mode.

@bitingsock You can verify if it's fixed with the latest dev release.

@LisoUseInAIKyrios LisoUseInAIKyrios linked a pull request Mar 9, 2025 that will close this issue
1 task
@LisoUseInAIKyrios LisoUseInAIKyrios changed the title bug: youtube crash at launch bug(YouTube - Theme): Android 8.0 dark mode startup crash Mar 9, 2025
@bitingsock
Copy link
Author

fix works great. good work! thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants