9***@qq.com
9***@qq.com
  • 发布:2024-12-09 15:03
  • 更新:2024-12-09 15:09
  • 阅读:77

【报Bug】Uts插件实现多个方法的接口 打包报错

分类:MUI

产品分类: 其他/MUI

操作步骤:

预期结果:

正常编译

实际结果:

正常编译

bug描述:

UTS插件:
1.jar包中有如下接口 其中User为自定义对象类
public interface ActionListener {
void onComplete(User var1, int var2, HashMap<String, Object> var3);

void onError(User var1, int var2, Throwable var3);  

void onCancel(User var1, int var2);  

}

2.uts插件中实现上述接口
import PlatformActionListener from 'xx.xxx.PlatformActionListener'
import HashMap from 'java.util.HashMap'

class lisnter extends ActionListener {
override onComplete(plat : User, act : Int, map : HashMap<String, Any>) : void {
Toast.makeText(UTSAndroid.getAppContext(), "onComplete", Toast.LENGTH_LONG).show();
};
override onError(plat : User, act : Int, thw : Throwable) : void {
Toast.makeText(UTSAndroid.getAppContext(), "onError", Toast.LENGTH_LONG).show();
};
override onCancel(plat : User, act : Int) : void {
Toast.makeText(UTSAndroid.getAppContext(), "onCancel", Toast.LENGTH_LONG).show();
}
}

3.打包时编译报错
e: file://[PackagePath]/wgtRoot/UNID274880/uni_modules/Demo/utssdk/app-android/src/index.kt:88:6 Class 'lisnter' is not abstract and does not implement abstract member public abstract fun onError(p0: Platform!, p1: Int, p2: Throwable!): Unit defined in xx.xxx.PlatformActionListener
e: file://[PackagePath]/wgtRoot/UNID274880/uni_modules/Demo/utssdk/app-android/src/index.kt:92:5 'onError' overrides nothing

2024-12-09 15:03 负责人:无 分享
已邀请:
DCloud_Android_DQQ

DCloud_Android_DQQ

没看出明显的语法错误,需要提供一下可以复现问题的示例代码

  • 9***@qq.com (作者)

    class lisnter extends ActionListener {

    override onComplete(plat : User, act : Int, map : HashMap<String, Any>) : void {

    Toast.makeText(UTSAndroid.getAppContext(), "onComplete", Toast.LENGTH_LONG).show();

    };

    override onError(plat : User, act : Int, thw : Throwable) : void {

    Toast.makeText(UTSAndroid.getAppContext(), "onError", Toast.LENGTH_LONG).show();

    };

    override onCancel(plat : User, act : Int) : void {

    Toast.makeText(UTSAndroid.getAppContext(), "onCancel", Toast.LENGTH_LONG).show();

    }

    }


    这个就是示例代码 实现了aar包中的接口

    2024-12-09 15:09

要回复问题请先登录注册