You need to unlock the bootloader and then you should be able to root it.
Although Nokia does not officially allow unlocked bootloader, it was recently made available mistakenly for the Nokia 4.2. You can check if it still works for you.
Nokia doesn't provide a way to unlock bootloader if you do find a way it will void your warranty and you might regret it later if the phone stops working I honestly don't recommend it and hey why would you wanna root when you have stock android
As I know, one-click rooting tools don't require unlocked boot loader. But, most of one-click tools only works on lower Android versions..Currently, Magisk is the most popular and successful rooting solution which essentially requires unlocked boot loader..Anyway, I would suggest visit XDA for advanced support for such issues
update : Just found an app named "VirtualXposed" (https://virtualxposed.org/) which promise to help users to run some of Xposed modules without root access. Perhaps you may already know Xposed is the most popular modding method for rooted Android. If you're unable to root your Nokia device,you may get some console using this app. Hope this information will be useful for users who are interested in root/administrative privileges.
Comments
You need to unlock the bootloader and then you should be able to root it.
Although Nokia does not officially allow unlocked bootloader, it was recently made available mistakenly for the Nokia 4.2. You can check if it still works for you.
To unlock the bootloader:
Once you have an unlocked bootloader, you can root by patching your boot image with Magisk and then booting/flashing it.
Nokia doesn't provide a way to unlock bootloader if you do find a way it will void your warranty and you might regret it later if the phone stops working I honestly don't recommend it and hey why would you wanna root when you have stock android
may be i want nokia 1 to unlock bootloader
As I know, one-click rooting tools don't require unlocked boot loader. But, most of one-click tools only works on lower Android versions..Currently, Magisk is the most popular and successful rooting solution which essentially requires unlocked boot loader..Anyway, I would suggest visit XDA for advanced support for such issues
update : Just found an app named "VirtualXposed" (https://virtualxposed.org/) which promise to help users to run some of Xposed modules without root access. Perhaps you may already know Xposed is the most popular modding method for rooted Android. If you're unable to root your Nokia device,you may get some console using this app. Hope this information will be useful for users who are interested in root/administrative privileges.
Visit the XDA forum, at your own risk-
https://forum.xda-developers.com/nokia-4-2
without bootloader code from Nokia u cant root ur phone.....and to date, Nokia hasn't announced rooting options for Nokia 4,2