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): Root installation crashes and fails to launch - ResourceNotFoundException on app start #2651

Closed
3 tasks done
programminghoch10 opened this issue Jan 27, 2024 · 17 comments · Fixed by #2655 or #2649
Closed
3 tasks done
Labels
Bug report Something isn't working

Comments

@programminghoch10
Copy link

programminghoch10 commented Jan 27, 2024

Bug description

The YouTube app crashes on the splash screen.
The logs show the issue is originating from the a ReVanced swipecontrols integration.

All default patches and options are applied, except disabled GmsCore support and enabled Custom branding .

Happens on the latest release (patches v4.0.1, integrations v1.2.0),
it did not happen on the previous version (patches v3.2.0, integrations v1.1.0).

Error logs

01-27 10:58:21.139  8842  8842 W YouTube : Forcefully created overlay:jsn@5ed3ec9 helper:Lazy@79b29ce view:null status: ....... {...}
01-27 10:58:21.142  8842  8842 W YouTube : Forcefully created overlay:klt@9834fd7 helper:Lazy@686b0c4 view:null status: ....... {✓..}
01-27 10:58:21.381  8842  8842 E android.youtube: Invalid ID 0x00000000.
01-27 10:58:21.381  8842  8842 D AndroidRuntime: Shutting down VM
01-27 10:58:21.381  8842  8842 E AndroidRuntime: FATAL EXCEPTION: main
01-27 10:58:21.381  8842  8842 E AndroidRuntime: Process: com.google.android.youtube, PID: 8842
01-27 10:58:21.381  8842  8842 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.youtube/com.google.android.apps.youtube.app.watchwhile.WatchWhileActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x0
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3645)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:138)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7924)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
01-27 10:58:21.381  8842  8842 E AndroidRuntime: Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:239)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.content.res.Resources.getDrawableForDensity(Resources.java:991)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.content.res.Resources.getDrawable(Resources.java:931)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at app.revanced.integrations.youtube.swipecontrols.views.SwipeControlsOverlayLayout.getDrawable(SwipeControlsOverlayLayout.kt:41)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at app.revanced.integrations.youtube.swipecontrols.views.SwipeControlsOverlayLayout.<init>(SwipeControlsOverlayLayout.kt:85)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at app.revanced.integrations.youtube.swipecontrols.SwipeControlsHostActivity.initialize(SwipeControlsHostActivity.kt:131)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at app.revanced.integrations.youtube.swipecontrols.SwipeControlsHostActivity.onCreate(SwipeControlsHostActivity.kt:73)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at com.google.android.apps.youtube.app.watchwhile.WatchWhileActivity.onCreate(PG:4)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:8342)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:8321)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3626)
01-27 10:58:21.381  8842  8842 E AndroidRuntime:        ... 12 more
01-27 10:58:21.393  5137  5646 W ActivityTaskManager:   Force finishing activity com.google.android.youtube/com.google.android.apps.youtube.app.watchwhile.InternalWatchWhileActivity

Solution

Patch using CLI tools and a prior dev release as described here.

Additional context

The patched YouTube APK is mounted onto the original APK using root.
Clearing app data and force stopping does not solve the issue.
The unpatched app starts up fine.

Acknowledgements

  • This issue is not a duplicate of an existing bug report.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
@programminghoch10 programminghoch10 added the Bug report Something isn't working label Jan 27, 2024
@programminghoch10 programminghoch10 changed the title bug: YouTube ResourceNotFoundException on app start bug(YouTube): ResourceNotFoundException on app start Jan 27, 2024
@oSumAtrIX
Copy link
Member

Is the unpatched app version the same as the patched app version?

@oSumAtrIX oSumAtrIX added the Waiting on author Further information is requested label Jan 27, 2024
@LisoUseInAIKyrios
Copy link
Contributor

I cannot reproduce this issue.

Try repatching and exclude swipe controls, and verify the patched app works correctly.

@oSumAtrIX
Copy link
Member

That patch appearing in the stack trace is because the class super is intercepted by that patch. The stack trace indicates that the mounted APK can not find the resources indicating that the mounted APK resource IDs mismatch the actual resources's IDs as the resources are located in splits which were built with a different version of the app.

@programminghoch10
Copy link
Author

Is the unpatched app version the same as the patched app version?

Yes it is.

@programminghoch10
Copy link
Author

That patch appearing in the stack trace is because the class super is intercepted by that patch. The stack trace indicates that the mounted APK can not find the resources indicating that the mounted APK resource IDs mismatch the actual resources's IDs as the resources are located in splits which were built with a different version of the app.

Yeah I also thought that, but I don't know how this is possible, I install the APK, then patch the APK then mount the patched APK onto the installed one and this happens.

The same happens for 3 different YouTube versions that I tried.
Maybe I should test another device or something.

@oSumAtrIX
Copy link
Member

We have received a couple reports similar to yours. Here is another stack trace:

2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: FATAL EXCEPTION: main
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: Process: com.google.android.apps.youtube, PID: 23123
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: java.lang.RuntimeException: Unable to destroy activity {com.google.android.apps.youtube/com.google.android.apps.youtube.app.watchwhile.InternalMainActivity}: java.lang.IllegalStateException: Primes did not observe lifecycle events in the expected order. com.google.android.apps.youtube is not initializing in Application#onCreate
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5309)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5339)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2246)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:233)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8010)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: Caused by: java.lang.IllegalStateException: Primes did not observe lifecycle events in the expected order. com.google.android.apps.youtube is not initializing in Application#onCreate
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at thl.a(PG:5)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at thl.onActivityDestroyed(PG:2)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.Application.dispatchActivityDestroyed(Application.java:582)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.Activity.dispatchActivityDestroyed(Activity.java:1510)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.Activity.onDestroy(Activity.java:2682)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at cd.onDestroy(PG:1)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at fo.onDestroy(PG:1)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at ghb.onDestroy(PG:2)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at nhp.onDestroy(PG:1)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at niv.onDestroy(PG:3)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at com.google.android.apps.youtube.app.watchwhile.MainActivity.onDestroy(PG:2)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.Activity.performDestroy(Activity.java:8251)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1364)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5294)
2024-01-27 17:43:58.237 23123 23123 ? E AndroidRuntime: 	... 11 more
2024-01-27 17:43:58.291  2047 27184 system I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
2

@Stardusstt
Copy link

Stardusstt commented Jan 27, 2024

same here, but YouTube crashes when I click "revanced(revanced specific settings)"

and how to select old patch through manager? try to reinstall 18.45.43 but will fail to patch


Android 13 , manager 1.79.0-dev.3 , patches v4.0.1, YouTube 19.03.55

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.apps.youtube/com.google.android.libraries.social.licenses.LicenseActivity}; have you declared this activity in your AndroidManifest.xml, or does your intent not match its declared <intent-filter>?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2217)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1859)
at android.app.Activity.startActivityForResult(Activity.java:5633)
at rh.startActivityForResult(PG:4)
at tsb.startActivityForResult(PG:5)
at android.app.Activity.startActivityForResult(Activity.java:5586)
at rh.startActivityForResult(PG:2)
at tsb.startActivityForResult(PG:2)
at android.app.Activity.startActivity(Activity.java:6104)
at tsb.startActivity(PG:5)
at com.google.android.apps.youtube.app.settings.SettingsActivity.startActivity(PG:8)
at android.app.Activity.startActivity(Activity.java:6071)
at tsb.startActivity(PG:2)
at com.google.android.apps.youtube.app.settings.SettingsActivity.startActivity(PG:4)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:442)
at androidx.preference.Preference.D(PG:4)
at androidx.preference.Preference.tH(PG:1)
at jy.onClick(PG:82)
at android.view.View.performClick(View.java:7591)
at android.view.View.performClickInternal(View.java:7564)
at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
at android.view.View$PerformClick.run(View.java:29914)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8321)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:581)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)

@oSumAtrIX oSumAtrIX removed the Waiting on author Further information is requested label Jan 27, 2024
@Y-T-G
Copy link

Y-T-G commented Jan 27, 2024

I was able to downgrade to 18.45.43. Some patches are unavailable, but it doesn't crash on startup like 19.xx

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Jan 27, 2024

I was able to downgrade to 18.45.43. Some patches are unavailable, but it doesn't crash on startup like 19.xx

Try patching 18.49.37. All patches support that version.

If that still doesn't work, try 18.48.39 which supports all patches except ReturnYouTubeDislike.

@Y-T-G
Copy link

Y-T-G commented Jan 27, 2024

I was able to downgrade to 18.45.43. Some patches are unavailable, but it doesn't crash on startup like 19.xx

Try patching 18.49.37. All patches support that version.

If that still doesn't work, try 18.48.39 which supports all patches except ReturnYouTubeDislike.

Both of them crash unfortunately. I removed "Copy Video URL" patch and 19.x doesn't crash. I guess anything that adds an icon or resource causes a crash. Many of the icons are broken too.

image

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Jan 27, 2024

Edit: the problem is fixed. Patch as usual using the latest release.

@LisoUseInAIKyrios LisoUseInAIKyrios changed the title bug(YouTube): ResourceNotFoundException on app start bug(YouTube): Root installation fails to launch - ResourceNotFoundException on app start Jan 27, 2024
@LisoUseInAIKyrios LisoUseInAIKyrios changed the title bug(YouTube): Root installation fails to launch - ResourceNotFoundException on app start bug(YouTube): Root installation crashes and fails to launch - ResourceNotFoundException on app start Jan 27, 2024
@andrea-musci
Copy link

andrea-musci commented Jan 27, 2024

If you have root on your android phone, disable patch auto update in revanced manager settings and then you can manually edit /data/user/0/app.revanced.manager.flutter/shared_prefs/FlutterSharedPreferences.xml to make it point to patches and integrations reported by LisoUseInAIKyrios.
In this way, revanced manager will use the custom patches version and make a patched youtube that can be installed with root method and that doesn't crash.
I just did it and it's working.
Thanks LisoUseInAIKyrios for sharing working patches version.

@Y-T-G
Copy link

Y-T-G commented Jan 27, 2024

If you have root on your android phone, disable patch auto update in revanced manager settings and then you can manually edit /data/user/0/app.revanced.manager.flutter/shared_prefs/FlutterSharedPreferences.xml to make it point to patches and integrations reported by LisoUseInAIKyrios. In this way, revanced manager will use the custom patches version and make a patched youtube that can be installed with root method and that doesn't crash. I just did it and it's working. Thanks LisoUseInAIKyrios for sharing working patches version.

Also had to delete everything in the folder except shared_prefs for it to stick.

@Ashkumar7
Copy link

If you have root on your android phone, disable patch auto update in revanced manager settings and then you can manually edit /data/user/0/app.revanced.manager.flutter/shared_prefs/FlutterSharedPreferences.xml to make it point to patches and integrations reported by LisoUseInAIKyrios. In this way, revanced manager will use the custom patches version and make a patched youtube that can be installed with root method and that doesn't crash. I just did it and it's working. Thanks LisoUseInAIKyrios for sharing working patches version.

flutter.integrationsDownloadURL this reverts back to the original url even after setting up integration url from up there. So even after patch is successful app still crashes. I think I have to wait for revanced app update. hope they fix it soon.

@mariondlsu
Copy link

If you have root on your android phone, disable patch auto update in revanced manager settings and then you can manually edit /data/user/0/app.revanced.manager.flutter/shared_prefs/FlutterSharedPreferences.xml to make it point to patches and integrations reported by LisoUseInAIKyrios. In this way, revanced manager will use the custom patches version and make a patched youtube that can be installed with root method and that doesn't crash. I just did it and it's working. Thanks LisoUseInAIKyrios for sharing working patches version.

Hi, it's kinda weird but I don't see app.revanced.manager.flutter folder. Am I doing something wrong ?

@reyqn
Copy link

reyqn commented Jan 28, 2024

Hi, it's kinda weird but I don't see app.revanced.manager.flutter folder. Am I doing something wrong ?

Try /data_mirror/data_ce/null/0/app.revanced.manager.flutter

@oSumAtrIX
Copy link
Member

oSumAtrIX commented Jan 28, 2024

This is not a support channel please move somewhere else. The issue is resolved.

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
9 participants