关于cocos在ts里面调用java静态方法的问题

  • Creator 版本: 3.6.1

  • 目标平台: Android 29

  • 重现方式:

  • 首个报错:03-20 10:11:15.310 10972 11335 E Cocos : 10:11:15 [ERROR]: [SE_ERROR] (G:/coco_files/Creator/3.6.1/resources/resources/3d/engine/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp, 606): call valid: 0, call.getArgumentsCount()= 2
    03-20 10:11:15.310 10972 11335 E Cocos : 10:11:15 [ERROR]: E/ [ERROR] Failed to invoke JavaScriptJavaBridge_callStaticMethod, location: G:/coco_files/Creator/3.6.1/resources/resources/3d/engine/native/cocos/bindings/manual/JavaScriptJavaBridge.cpp:612
    03-20 10:11:15.310 10972 11335 E Cocos :
    03-20 10:11:15.310 10972 11335 E Cocos : 10:11:15 [ERROR]: [SE_ERROR] (G:/coco_files/Creator/3.6.1/resources/resources/3d/engine/native/cocos/bindings/jswrapper/v8/Object.cpp, 677): Invoking function failed, Error: class not found
    03-20 10:11:15.310 10972 11335 E Cocos : at Function.showRewardVideo (assets/main/index.js:1:375)
    03-20 10:11:15.310 10972 11335 E Cocos : at R.callBackBtn (assets/main/index.js:5:12868)
    03-20 10:11:15.310 10972 11335 E Cocos : at t.emit (src/cocos-js/cc.js:1:250383)
    03-20 10:11:15.310 10972 11335 E Cocos : at Function.emitEvents (src/cocos-js/cc.js:1:250062)
    03-20 10:11:15.310 10972 11335 E Cocos : at gq._onTouchEnded (src/cocos-js/cc.js:1:1176996)
    03-20 10:11:15.310 10972 11335 E Cocos : at sa.emit (src/cocos-js/cc.js:1:185252)
    03-20 10:11:15.310 10972 11335 E Cocos : at yE.dispatchEvent (src/cocos-
    03-20 10:11:15.310 10972 11335 E Cocos : 10:11:15 [ERROR]: [SE_ERROR] (G:/coco_files/Creator/3.6.1/resources/resources/3d/engine/native/cocos/bindings/jswrapper/v8/Object.cpp, 687): Invoking function (0xb098f670) failed!

  • 之前哪个版本是正常的: 无

  • 手机型号: 红米9A安卓9

  • 手机浏览器:

  • 编辑器操作系统:

  • 重现概率:

TS文件:

import { _decorator, Component, Node, native } from “cc”;

const { ccclass, property } = _decorator;

@ccclass(“ad”)

export class ad extends Component {

start() {}

update(deltaTime: number) {}

static showRewardVideo(…parameters: any) {

var o = native.reflection.callStaticMethod(

  "com/xunwei/zhihuiaixca/simulationa/gromore/AdManager",

  "showRewardVideo",

  "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;",

  parameters

);

}

}

Java文件:

package com.xunwei.zhihuiaixca.simulationa.promore;
public class AdManager {

public static String showRewardVideo(String... paramers){


    return "";
}

}