Create own Custom Magisk Module

Search This thread

Uvneshkumar

Senior Member
Feb 10, 2017
315
405
24
Chennai
Hi devs,

Now I want to create a magisk module which replaces the functionalities of a system app. Consider for example, I'm running a custom ROM which I built and I have the complete source of the ROM. After the ROM is built and flashed, I want to change the functionality of an app using Magisk. Now after making the changes which I need, I build that and get the new APK file along with its odex and vdex files.

Now without replacing the files in the system partition, can I use magisk to use the updated apk instead of the old apk. If that is possible, can anyone give me some quick steps how to do it.
@Rajeev @sooti - I think you can help me coz you've been making some magisk modules for Mi A1.

Or anyone else who knows this, kindly help me.
 
Last edited:

chudy_85

Senior Member
Jul 26, 2011
1,566
602
some where in europe
Hi devs,

Now I want to create a magisk module which replaces the functionalities of a system app. Consider for example, I'm running a custom ROM which I built and I have the complete source of the ROM. After the ROM is built and flashed, I want to change the functionality of an app using Magisk. Now after making the changes which I need, I build that and get the new APK file along with its odex and vdex files.

Now without replacing the files in the system partition, can I use magisk to use the updated apk instead of the old apk. If that is possible, can anyone give me some quick steps how to do it.

@Rajeev - I think you can help me coz you've been making some magisk modules for Mi A1.

Or anyone else who knows this, kindly help me.
If you use Magisk v15.3 and want only change APK file put to system/app if you want change on this partition if you have in system/priv You must do it that same but you must mount this and then after flash in Magisk you have new APK. Meybe some one write that same. I create mod but only mount APK file in system/app because I don't have there this file. Try flash, check it work and then you can share with all
 
Last edited:

Uvneshkumar

Senior Member
Feb 10, 2017
315
405
24
Chennai
If you use Magisk v15.3 and want only change APK file put to system/app if you want change on this partition if you have in system/priv You must do it that same but you must mount this and then after flash in Magisk you have new APK. Meybe some one write that same. I create mod but only mount APK file in system/app because I don't have there this file. Try flash, check it work and then you can share with all

OK. Will try that.
 

Jaymin.0.1910

Senior Member
Sep 20, 2017
554
489
Himmatnagar
Hi devs,

Now I want to create a magisk module which replaces the functionalities of a system app. Consider for example, I'm running a custom ROM which I built and I have the complete source of the ROM. After the ROM is built and flashed, I want to change the functionality of an app using Magisk. Now after making the changes which I need, I build that and get the new APK file along with its odex and vdex files.

Now without replacing the files in the system partition, can I use magisk to use the updated apk instead of the old apk. If that is possible, can anyone give me some quick steps how to do it.
@Rajeev @sooti - I think you can help me coz you've been making some magisk modules for Mi A1.

Or anyone else who knows this, kindly help me.

You should refer to the official documentation of Magisk to understand the structure of a Magisk module, once you understood it well, you can make highly customizable Magisk mods without needing to use topjohnwu's template.

For the case you asked about, you can simply create a flashable shell zip, which will create a structure something similar to this,
Code:
MOUNTPOINT=/sbin/.core/img
MODID=your_mod_id_here
--> MOUNTPOINT
    --> MODID
        --> auto_mount
        --> module.prop
        --> system
            --> {priv-,}app
                --> app_name.apk
                --> app_name.{o,v,}dex
            --> etc/permissions/package_name-permissions.xml
        --> service.sh
        --> post-fs-data.sh
Using topjohnwu's template will be much simpler, boot scripts are optional, the perms XML is also needed only if (priv-app && API >= 26)

EDIT: Almost forgot it, thanks for providing our Le Max 2 an Oreo ROM!
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    Hi devs,

    Now I want to create a magisk module which replaces the functionalities of a system app. Consider for example, I'm running a custom ROM which I built and I have the complete source of the ROM. After the ROM is built and flashed, I want to change the functionality of an app using Magisk. Now after making the changes which I need, I build that and get the new APK file along with its odex and vdex files.

    Now without replacing the files in the system partition, can I use magisk to use the updated apk instead of the old apk. If that is possible, can anyone give me some quick steps how to do it.
    @Rajeev @sooti - I think you can help me coz you've been making some magisk modules for Mi A1.

    Or anyone else who knows this, kindly help me.

    You should refer to the official documentation of Magisk to understand the structure of a Magisk module, once you understood it well, you can make highly customizable Magisk mods without needing to use topjohnwu's template.

    For the case you asked about, you can simply create a flashable shell zip, which will create a structure something similar to this,
    Code:
    MOUNTPOINT=/sbin/.core/img
    MODID=your_mod_id_here
    --> MOUNTPOINT
        --> MODID
            --> auto_mount
            --> module.prop
            --> system
                --> {priv-,}app
                    --> app_name.apk
                    --> app_name.{o,v,}dex
                --> etc/permissions/package_name-permissions.xml
            --> service.sh
            --> post-fs-data.sh
    Using topjohnwu's template will be much simpler, boot scripts are optional, the perms XML is also needed only if (priv-app && API >= 26)

    EDIT: Almost forgot it, thanks for providing our Le Max 2 an Oreo ROM!
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone