Skip to content
Discussion options

You must be logged in to vote

@RealOkabe you can try this method

public static Object getConstValueByArg(RootNode root, InsnArg arg) {

like this:

import jadx.core.dex.instructions.InsnType
import jadx.core.dex.instructions.args.LiteralArg
import jadx.core.utils.InsnUtils

val jadx = getJadxInstance()

jadx.replace.insns { mth, insn ->
	if (insn.type == InsnType.FILLED_NEW_ARRAY) {
		val byteArr = ByteArray(insn.argsCount)
		var i = 0
		insn.arguments.forEach { arg ->
			val constVal = InsnUtils.getConstValueByArg(mth.root(), arg)
			if (constVal is LiteralArg) {
				byteArr[i++] = constVal.literal.toByte()
			}
		}
		jadx.…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by RealOkabe
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants