E/weex: end getBundleType type:Vue time:0
E/timeline: createInstance :1619597867918
E/jsEngine: script_bridge_in_multi_process.cpp:473,ScriptBridgeInMultiProcess::CreateInstance and Id is : 2
E/shutao: UniComponent
E/weex: WXComponentFactory Exception type:[MyBtn] com.taobao.weex.common.WXRuntimeException: Can't find constructor of component.
at com.taobao.weex.ui.SimpleComponentHolder$ClazzComponentCreator.getComponentConstructor(SimpleComponentHolder.java:108)
at com.taobao.weex.ui.SimpleComponentHolder$ClazzComponentCreator.createInstance(SimpleComponentHolder.java:121)
at com.taobao.weex.ui.SimpleComponentHolder.createInstance(SimpleComponentHolder.java:237)
at com.taobao.weex.ui.component.WXComponentFactory.newInstance(WXComponentFactory.java:66)
at com.taobao.weex.ui.action.GraphicActionAbstractAddElement.createComponent(GraphicActionAbstractAddElement.java:61)
at com.taobao.weex.ui.action.GraphicActionAddElement.<init>(GraphicActionAddElement.java:86)
at com.taobao.weex.bridge.WXBridgeManager.callAddElement(WXBridgeManager.java:2806)
at com.taobao.weex.bridge.WXBridge.callAddElement(WXBridge.java:535)
at com.taobao.weex.base.SystemMessageHandler.nativeRunWork(Native Method)
at com.taobao.weex.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:104)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.os.HandlerThread.run(HandlerThread.java:67)
[WXBridgeManager] callAddElement exception: java.lang.NullPointerException: Attempt to invoke virtual method 'com.taobao.weex.dom.WXAttr com.taobao.weex.ui.component.basic.WXBasicComponent.getAttrs()' on a null object reference
at com.taobao.weex.ui.RenderContextImpl.registerComponent(RenderContextImpl.java:86)
at com.taobao.weex.ui.WXRenderManager.registerComponent(WXRenderManager.java:306)
at com.taobao.weex.ui.action.GraphicActionAbstractAddElement.createComponent(GraphicActionAbstractAddElement.java:62)
at com.taobao.weex.ui.action.GraphicActionAddElement.<init>(GraphicActionAddElement.java:86)
at com.taobao.weex.bridge.WXBridgeManager.callAddElement(WXBridgeManager.java:2806)
at com.taobao.weex.bridge.WXBridge.callAddElement(WXBridge.java:535)
at com.taobao.weex.base.SystemMessageHandler.nativeRunWork(Native Method)
at com.taobao.weex.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:104)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.os.HandlerThread.run(HandlerThread.java:67)
E/weex: commitCriticalExceptionRT :WX_KEY_EXCEPTION_INVOKE_BRIDGEexceptionjava.lang.NullPointerException: Attempt to invoke virtual method 'com.taobao.weex.dom.WXAttr com.taobao.weex.ui.component.basic.WXBasicComponent.getAttrs()' on a null object reference
at com.taobao.weex.ui.RenderContextImpl.registerComponent(RenderContextImpl.java:86)
at com.taobao.weex.ui.WXRenderManager.registerComponent(WXRenderManager.java:306)
at com.taobao.weex.ui.action.GraphicActionAbstractAddElement.createComponent(GraphicActionAbstractAddElement.java:62)
at com.taobao.weex.ui.action.GraphicActionAddElement.<init>(GraphicActionAddElement.java:86)
at com.taobao.weex.bridge.WXBridgeManager.callAddElement(WXBridgeManager.java:2806)
at com.taobao.weex.bridge.WXBridge.callAddElement(WXBridge.java:535)
at com.taobao.weex.base.SystemMessageHandler.nativeRunWork(Native Method)
at com.taobao.weex.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:104)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.os.HandlerThread.run(HandlerThread.java:67)
1***@163.com
- 发布:2021-04-28 16:22
- 更新:2022-08-18 14:41
- 阅读:1981
UniComponent的构造函数有两个,一个4个参数的,一个3个参数的。你只实现了4个参数的构造函数,官方的TextView实现的3个参数的构造函数。估计报错的时候调用的是3个参数的,你加个3个参数的构造函数应该就可以了
1***@163.com (作者) - 拉直索尔
sdk:Android-SDK@3.1.11.80806_20210425
hbuildversion:3.1.11.20210423
报错的代码
package com.uninative.mycomponent;
import android.content.Context;
import android.support.annotation.NonNull;
import android.widget.Button;
import io.dcloud.feature.uniapp.UniSDKInstance;
import io.dcloud.feature.uniapp.ui.action.AbsComponentData;
import io.dcloud.feature.uniapp.ui.component.AbsVContainer;
import io.dcloud.feature.uniapp.ui.component.UniComponent;
public class MyButton extends UniComponent<Button> {
public MyButton(UniSDKInstance instance, AbsVContainer parent, int type, AbsComponentData componentData) {
super(instance, parent, type, componentData);
}
@Override
protected Button initComponentHostView(@NonNull Context context) {
Button btn=new Button(context);
btn.setText("哈哈");
return btn;
}
}
b***@qq.com
你是对的
2022-05-06 10:16
3***@qq.com
确实是构造方法的问题,重写一下构造方法就可以了
2022-06-06 13:56