Java.perform(function () {
//静态属性修改
let personClazz = Java.use(“com.example.hookdemo.Person”);
console.log(“值:” + personClazz.age.value)//访问静态字段
console.log(“值:” + personClazz._print.value)//访问与方法同名的字段需要加下划线
//动态属性修改
Java.choose("com.example.hookdemo.Person", {
onMatch: function (instance) {
instance.name.value="被修改的name"
console.log(instance.name.value)
}, onComplete: function () {
console.log("end")
}
})
})