问题 java.lang.ClassCastException: java.lang.Object[] 无法转换为 android.content.Intent[]
代码如下: frida-js:
var ProcessManagerG = Java.use('com.xxx.xxx.processManager.g')
var doInBackground = ProcessManagerG.doInBackground.overload('[Ljava.lang.Object;')
doInBackground.implementation = function (intentArr) {
doInBackground.call(this, intentArr)
}
不是其他几种方式。这里是所有代码。其他代码已被删除。
- 错误:java.lang.ClassCastException:java.lang.Object[] 无法转换为 android.content.Intent[]
Java.perform(function () {
Java.use('com.xxx.xxx.processManager.g').doInBackground.overload('[Ljava.lang.Object;').implementation = function (intentArr) {
try {
return this.doInBackground.apply(this, arguments);
} catch (e) {
console.log(e)
}
}
})
- 错误:doInBackground():参数类型不匹配任何一个:.overload('[Ljava.lang.Object;')
Java.perform(function () {
Java.use('com.xxx.xxx.processManager.g').doInBackground.overload('[Ljava.lang.Object;').implementation = function (intentArr) {
try {
var arr = [];
for (var i = 0, len = intentArr.length; i < len; i++) {
// console.log(arguments[i], Object.prototype.toString.call(arguments[i]))
send(intentArr[i]) // {'type': 'send', 'payload': ['<instance: java.lang.Object, $className: android.content.Intent>']}
arr.push(Java.cast(intentArr[i], Java.use('android.content.Intent')))
send(arr) // {'type': 'send', 'payload': ['<instance: android.content.Intent>']}
}
return this.doInBackground.apply(this, arr); // Error: doInBackground(): argument types do not match any of: .overload('[Ljava.lang.Object;')
} catch (e) {
console.log(e)
}
}
})
- 错误:doInBackground():参数类型不匹配任何一个:.overload('[Ljava.lang.Object;')
Java.perform(function () {
Java.use('com.xxx.xxx.processManager.g').doInBackground.overload('[Ljava.lang.Object;').implementation = function (intentArr) {
try {
send(intentArr) // {'type': 'send', 'payload': ['<instance: java.lang.Object, $className: android.content.Intent>']}
var arr = Java.array('Landroid.content.Intent;', intentArr);
send(arr) // {'type': 'send', 'payload': ['<instance: android.content.Intent>']}
return this.doInBackground.apply(this, arr); // Error: doInBackground(): argument types do not match any of: .overload('[Ljava.lang.Object;')
} catch (e) {
console.log(e)
}
}
})
- 错误:doInBackground():参数类型不匹配任何一个:.overload('[Ljava.lang.Object;')
Java.perform(function () {
Java.use('com.xxx.xxx.processManager.g').doInBackground.overload('[Ljava.lang.Object;').implementation = function (intentArr) {
try {
var arr = [];
for (var i = 0, len = intentArr.length; i < len; i++) {
send(intentArr[i]) // {'type': 'send', 'payload': ['<instance: java.lang.Object, $className: android.content.Intent>']}
arr.push(Java.cast(intentArr[i], Java.use('android.content.Intent')))
send(arr) // {'type': 'send', 'payload': ['<instance: android.content.Intent>']}
}
return this.doInBackground(Java.array('java.lang.Object', arr));
} catch (e) {
console.log(e)
}
}
})
爪哇:
public Intent doInBackground(Intent... intentArr) {}
小号:
.method protected synthetic doInBackground([Ljava/lang/Object;)Ljava/lang/Object;
.registers 2
.line 61
check-cast p1, [Landroid/content/Intent;
invoke-virtual {p0, p1}, Lcom/xxx/xxx/processManager/g;->a([Landroid/content/Intent;)Landroid/content/Intent;
move-result-object p1
return-object p1
.end method
感谢你的回答