aliyun / aliyun-oss-react-native

MIT License
149 stars 103 forks source link

Attempt to invoke virtual method 'void com.reactlibrary.AliyunUploadManager.asyncUpload(com.facebook.react.bridge.ReactContext, java.lang.String, java.lang.String, java.lang.String, com.facebook.react.bridge.ReadableMap, com.facebook.react.bridge.Promise)' on a null object reference #85

Open wutiange opened 4 years ago

wutiange commented 4 years ago

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.reactlibrary.AliyunUploadManager.asyncUpload(com.facebook.react.bridge.ReactContext, java.lang.String, java.lang.String, java.lang.String, com.facebook.react.bridge.ReadableMap, com.facebook.react.bridge.Promise)' on a null object reference at com.reactlibrary.RNAliyunOssModule.asyncUpload(RNAliyunOssModule.java:188) at java.lang.reflect.Method.invoke(Method.java) at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:371) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150) at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java) at android.os.Handler.handleCallback(Handler.java:900) at android.os.Handler.dispatchMessage(Handler.java:103) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26) at android.os.Looper.loop(Looper.java:219) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225) at java.lang.Thread.run(Thread.java:929)

不知道为啥会出现这个错误,而且还不少。我去看了android 的代码,我觉得AliyunUploadManager不可能为空,我们初始化的代码initWithSecurityToken是在app启动的时候调用的,而且在使用之前都会initWithSecurityToken一下,所以不可能为空。希望哪个帮我解决一下这个问题。这个错误是错误收集帮我收集到的错误。

wutiange commented 4 years ago

"react": "16.9.0", "react-native": "0.61.5", "aliyun-oss-react-native": "^1.0.0-alpha.7",

newyoung21 commented 2 years ago

@wutiange 请问解决了吗?