You can do this and debug the malicious application without any problems. Ida allows you to do this very smoothly and gently, you only need to open classes.dex inside the apk for IDA PRO and configure the Davilk debugger. But you can also do it the same way as if you were writing an application, for example, using eclipse.
Only a limitation, since the application’s manifest does not allow debugging (for example, the worst case scenario and malware), you need to have an engineering device so that you can attach your IDA Pro or debugger, I mean a device in which
$ getprop ro.debuggable 1 $ getprop ro.secure 0
It is also very easy to satisfy these conditions if you can unlock the bootloader of your device and edit the ramdisk settings ro.debuggable = 1 and ro.secure = 0 inside the initfiles. Alternatively, if your device was deployed, you could use setpropex to easily change read properties this way.
# ./setpropex ro.debuggable 1
github for setpropex https://github.com/poliva/rootadb/blob/master/jni/setpropex.c
source share