[MODULE] Adfree YouTube Template

vemacs

Member
Jul 8, 2014
30
42
0
I couldn't find an existing way to replace the YouTube APK without modifying /system and triggering SafetyNet, so I made a template module for this.

You will need to uninstall all updates to the YouTube app (disable and re-enable it in settings) and disable automatic updates for it in the Play Store before installing this module.

Just download the zip file and replace system/app/YouTube/YouTube.apk in the ZIP file (using 7zip or similar, I've also had success with MiXplorer) with your preferred YouTube APK, and install it in Magisk Manager. You probably need root to run this. Here are the replacements that I use, although you can use literally anything (OG YouTube, etc...):

http://arter97.com/browse/youtube/adaway/

Hope this helps somebody. To update, replace the APK in the ZIP file again, and install the new module. If you are running a full ROM under Magisk, this likely won't work and you should put YouTube in your ROM's ZIP file instead.
 

Attachments

Last edited:

JEANRIVERA

Senior Member
Mar 30, 2007
2,984
1,465
193
39
Nazareth, PA
I couldn't find an existing way to replace the YouTube APK without modifying /system and triggering SafetyNet, so I made a template module for this. Just download the zip file and replace system/app/YouTube/YouTube.apk in the ZIP file (using 7zip or similar) with your preferred YouTube APK, and install it in Magisk Manager. Here are the replacements that I use, although you can use literally anything:

http://arter97.com/browse/youtube/adaway/

Hope this helps somebody. To update, uninstall the existing module, replace the APK in the ZIP file again, and install the new module.
your module does not work it gave me an error when instaling from TWRP and it does not install as a module
 

Doctor Zoidberg

Senior Member
Sep 6, 2016
138
29
0
Halstenbek
I couldn't find an existing way to replace the YouTube APK without modifying /system and triggering SafetyNet, so I made a template module for this. Just download the zip file and replace system/app/YouTube/YouTube.apk in the ZIP file (using 7zip or similar) with your preferred YouTube APK, and install it in Magisk Manager. Here are the replacements that I use, although you can use literally anything:

http://arter97.com/browse/youtube/adaway/

Hope this helps somebody. To update, uninstall the existing module, replace the APK in the ZIP file again, and install the new module.
Galaxy S7 Edge Renovate Nougat

Have Bootloop. :/

Gesendet von meinem SM-G935F mit Tapatalk
 

vemacs

Member
Jul 8, 2014
30
42
0
Works for me on a OnePlus 3. Did you put in your YouTube.apk properly, and have you checked that your ROM has the YouTube app in /system/app/YouTube and not /system/priv-app/YouTube? What program did you use to put your YouTube.apk in the zip file?

For reference, I've attached a ZIP file that works on my phone (arm64 480dpi OP3 running Nougat). It should work for arm64 <=480dpi phones that have the original YouTube app in /system/app/YouTube.
 

Attachments

Last edited:

JEANRIVERA

Senior Member
Mar 30, 2007
2,984
1,465
193
39
Nazareth, PA
You have to make your own ZIP file and put your own YouTube.apk in... Please read the instructions.
For you information I did read the instructions and followed them I am running a whole magisk Rom as a magisk module and couple of other modules, your module does not work in my configuration maybe works for someone else
 

vemacs

Member
Jul 8, 2014
30
42
0
For you information I did read the instructions and followed them I am running a whole magisk Rom as a magisk module and couple of other modules, your module does not work in my configuration maybe works for someone else
I think that's probably the issue, the full ROM is causing some incompatibility with this mount (broken Google play services, etc...?) I'll add that to the readme. You can try modifying your ROM's ZIP to include the YouTube.apk.
 
Last edited:

Silkeyway

Senior Member
Jul 1, 2014
53
7
0
Works for me on a OnePlus 3. Did you put in your YouTube.apk properly, and have you checked that your ROM has the YouTube app in /system/app/YouTube and not /system/priv-app/YouTube? What program did you use to put your YouTube.apk in the zip file?

For reference, I've attached a ZIP file that works on my phone (arm64 480dpi OP3 running Nougat). It should work for arm64 <=480dpi phones that have the original YouTube app in /system/app/YouTube.
Just installed this because I got a OP3 as well, installed fine, phone booted without problem, but apparently it didn't do anything...? Still getting ads.
Could magisk hide be a problem?
Following is my magisk log in case it could be of any help.
** Magisk post-fs mode running...
** Magisk post-fs-data mode running...
/data/magisk_merge.img found
/data/magisk.img found, attempt to merge
Expanding /data/magisk.img to 128M...
/dev/block/loop0 /data/magisk.img
/dev/block/loop1 /data/magisk_merge.img
Merging: adfreeyoutube
Merge complete
* Preparing modules
* Stage 1: Mount system and vendor mirrors
* Stage 2: Mount dummy skeletons
* Stage 3: Mount module items
Mount: /magisk/adfreeyoutube/system/app/YouTube
* Stage 4: Execute module scripts
post-fs-data: /magisk/xposed/post-fs-data.sh
Xposed: Mount: /magisk/xposed/system/lib64/libsigchain.so
Xposed: Mount: /magisk/xposed/system/lib64/libart.so
Xposed: Mount: /magisk/xposed/system/lib64/libart-disassembler.so
Xposed: Mount: /magisk/xposed/system/lib/libsigchain.so
Xposed: Mount: /magisk/xposed/system/lib/libart.so
Xposed: Mount: /magisk/xposed/system/lib/libart-compiler.so
Xposed: Mount: /magisk/xposed/system/bin/patchoat
Xposed: Mount: /magisk/xposed/system/bin/oatdump
Xposed: Mount: /magisk/xposed/system/bin/dex2oat
Xposed: Mount: /magisk/xposed/system/bin/app_process64
Xposed: Mount: /magisk/xposed/system/bin/app_process32
* Stage 5: Mount mirrored items back to dummy
* Enabling systemless hosts file support
Mount: /magisk/.core/hosts
* Enabling BusyBox
Mount: /magisk/.core/busybox
** Magisk late_start service mode running...
service: /magisk/phh/service.sh
phh: Live patching sepolicy
phh: Moving and linking /sbin binaries
phh: Mounting supath
phh: Starting su daemon
* Removing tampered read-only system props
* Starting Magisk Hide
MagiskHide: Update process/package list:
MagiskHide: [com.google.android.gms.unstable]
Zygote(0) ns=mnt:[4026534089] Zygote(1) ns=mnt:[4026534090]
MagiskHide: com.google.android.gms.unstable(PID=8149 ns=mnt:[4026534326])
MagiskHide: Unmounted (/sbin)
MagiskHide: Unmounted (/magisk)
MagiskHide: Unmounted (/system/xbin)
MagiskHide: Unmounted (/system/etc/hosts)
MagiskHide: Unmounted (/system/bin/dex2oat)
MagiskHide: Unmounted (/system/bin/oatdump)
MagiskHide: Unmounted (/system/bin/patchoat)
MagiskHide: Unmounted (/system/lib/libart-compiler.so)
MagiskHide: Unmounted (/system/lib/libart.so)
MagiskHide: Unmounted (/system/lib/libsigchain.so)
MagiskHide: Unmounted (/system/lib64/libart-disassembler.so)
MagiskHide: Unmounted (/system/lib64/libart.so)
MagiskHide: Unmounted (/system/lib64/libsigchain.so)
MagiskHide: Unmounted (/system/app/YouTube)
 

bilibox

Senior Member
Sep 19, 2011
1,119
409
0
California
Just installed this because I got a OP3 as well, installed fine, phone booted without problem, but apparently it didn't do anything...? Still getting ads.
Could magisk hide be a problem?
Following is my magisk log in case it could be of any help.
** Magisk post-fs mode running...
** Magisk post-fs-data mode running...
/data/magisk_merge.img found
/data/magisk.img found, attempt to merge
Expanding /data/magisk.img to 128M...
/dev/block/loop0 /data/magisk.img
/dev/block/loop1 /data/magisk_merge.img
Merging: adfreeyoutube
Merge complete
* Preparing modules
* Stage 1: Mount system and vendor mirrors
* Stage 2: Mount dummy skeletons
* Stage 3: Mount module items
Mount: /magisk/adfreeyoutube/system/app/YouTube
* Stage 4: Execute module scripts
post-fs-data: /magisk/xposed/post-fs-data.sh
Xposed: Mount: /magisk/xposed/system/lib64/libsigchain.so
Xposed: Mount: /magisk/xposed/system/lib64/libart.so
Xposed: Mount: /magisk/xposed/system/lib64/libart-disassembler.so
Xposed: Mount: /magisk/xposed/system/lib/libsigchain.so
Xposed: Mount: /magisk/xposed/system/lib/libart.so
Xposed: Mount: /magisk/xposed/system/lib/libart-compiler.so
Xposed: Mount: /magisk/xposed/system/bin/patchoat
Xposed: Mount: /magisk/xposed/system/bin/oatdump
Xposed: Mount: /magisk/xposed/system/bin/dex2oat
Xposed: Mount: /magisk/xposed/system/bin/app_process64
Xposed: Mount: /magisk/xposed/system/bin/app_process32
* Stage 5: Mount mirrored items back to dummy
* Enabling systemless hosts file support
Mount: /magisk/.core/hosts
* Enabling BusyBox
Mount: /magisk/.core/busybox
** Magisk late_start service mode running...
service: /magisk/phh/service.sh
phh: Live patching sepolicy
phh: Moving and linking /sbin binaries
phh: Mounting supath
phh: Starting su daemon
* Removing tampered read-only system props
* Starting Magisk Hide
MagiskHide: Update process/package list:
MagiskHide: [com.google.android.gms.unstable]
Zygote(0) ns=mnt:[4026534089] Zygote(1) ns=mnt:[4026534090]
MagiskHide: com.google.android.gms.unstable(PID=8149 ns=mnt:[4026534326])
MagiskHide: Unmounted (/sbin)
MagiskHide: Unmounted (/magisk)
MagiskHide: Unmounted (/system/xbin)
MagiskHide: Unmounted (/system/etc/hosts)
MagiskHide: Unmounted (/system/bin/dex2oat)
MagiskHide: Unmounted (/system/bin/oatdump)
MagiskHide: Unmounted (/system/bin/patchoat)
MagiskHide: Unmounted (/system/lib/libart-compiler.so)
MagiskHide: Unmounted (/system/lib/libart.so)
MagiskHide: Unmounted (/system/lib/libsigchain.so)
MagiskHide: Unmounted (/system/lib64/libart-disassembler.so)
MagiskHide: Unmounted (/system/lib64/libart.so)
MagiskHide: Unmounted (/system/lib64/libsigchain.so)
MagiskHide: Unmounted (/system/app/YouTube)
Yes. Dont use magisk hide on youtube. Per "the replacements" link in the OP it looks like it requires root.
 

adamjmacdonald

Senior Member
May 11, 2016
52
15
0
Maybe I'm misunderstanding how Magisk works, but google play updated youtube after I successfully applied this template with a custom apk. After I restarted, it stayed updated with the clean apk. How is this possible for google play services update to update a systemless-applied apk.
 

waylo

Senior Member
May 9, 2010
1,652
487
113
If you didn't turn off automatic updates in the Playstore, it probably can update whatever apps automatically. Turn it off. Playstore can do system-app updates.
 

Natanji

Member
Feb 25, 2014
26
1
0
Works for me on a OnePlus 3. Did you put in your YouTube.apk properly, and have you checked that your ROM has the YouTube app in /system/app/YouTube and not /system/priv-app/YouTube? What program did you use to put your YouTube.apk in the zip file?

For reference, I've attached a ZIP file that works on my phone (arm64 480dpi OP3 running Nougat). It should work for arm64 <=480dpi phones that have the original YouTube app in /system/app/YouTube.
I tried both putting an up-to-date YouTube.apk into the zip myself, and then after it didn't work I tried again with your ZIP from the quoted post here - but in neither case I had any success: YouTube still plays ads. I'm also on a OnePlus 3, I'm running stock OxygenOS 4.0.2 (up to date).

Any ideas? Is there some sort of logging to see what might have went wrong?
 

vemacs

Member
Jul 8, 2014
30
42
0
I tried both putting an up-to-date YouTube.apk into the zip myself, and then after it didn't work I tried again with your ZIP from the quoted post here - but in neither case I had any success: YouTube still plays ads. I'm also on a OnePlus 3, I'm running stock OxygenOS 4.0.2 (up to date).

Any ideas? Is there some sort of logging to see what might have went wrong?
Uninstall all updates and disable auto-updates for YouTube before installing module, I added this info to the OP.