sp-react-native-in-app-updates icon indicating copy to clipboard operation
sp-react-native-in-app-updates copied to clipboard

java.lang.RuntimeException: Could not invoke SpInAppUpdates.checkNeedsUpdate

Open alexander0205 opened this issue 2 years ago • 12 comments

This error is happening using the abb or apk in the smart FATAL EXCEPTION: mqt_native_modules Process: com.app, PID: 27571 java.lang.RuntimeException: Could not invoke SpInAppUpdates.checkNeedsUpdate

alexander0205 avatar Jun 30 '23 15:06 alexander0205

can you provide a full stacktrace please? 🙏

SudoPlz avatar Jun 30 '23 16:06 SudoPlz

can you provide a full stacktrace please? 🙏

Yes:

FATAL EXCEPTION: mqt_native_modules
Process: com.dixtra.app, PID: 27571
java.lang.RuntimeException: Could not invoke SpInAppUpdates.checkNeedsUpdate
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
at com.facebook.jni.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:888)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:213)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:929)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188) 
at com.facebook.jni.NativeRunnable.run(Native Method) 
at android.os.Handler.handleCallback(Handler.java:888) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) 
at android.os.Looper.loop(Looper.java:213) 
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228) 
at java.lang.Thread.run(Thread.java:929) 
Caused by: java.lang.NoSuchMethodError: No interface method getAppUpdateInfo()Lcom/google/android/gms/tasks/Task; in class Lcom/google/android/play/core/appupdate/AppUpdateManager; or its super classes (declaration of 'com.google.android.play.core.appupdate.AppUpdateManager' appears in /data/app/com.dixtra.zenks.nippydelivery-4dwakNCSSSLl9bdgD3DMew==/base.apk!classes2.dex)
at com.sudoplz.rninappupdates.SpReactNativeInAppUpdatesModule.checkNeedsUpdate(SpReactNativeInAppUpdatesModule.java:93)
at java.lang.reflect.Method.invoke(Native Method) 
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372) 
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188) 
at com.facebook.jni.NativeRunnable.run(Native Method) 
at android.os.Handler.handleCallback(Handler.java:888) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) 
at android.os.Looper.loop(Looper.java:213) 
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228) 
at java.lang.Thread.run(Thread.java:929) 

alexander0205 avatar Jun 30 '23 16:06 alexander0205

@SudoPlz We are also facing the same issue

image

Unhandled error

Error: sp-react-native-in-app-updates startUpdate error: Error: Update type unavailable, check checkNeedsUpdate.isImmediateUpdateAllowed or checkNeedsUpdate.isFlexibleUpdateAllowed first. 
    node_modules/sp-react-native-in-app-updates/src/InAppUpdatesBase.ts:20:10 anonymous
    node_modules/sp-react-native-in-app-updates/src/InAppUpdates.android.ts:184:6 anonymous
    /tmp/hermes/staging/hermes/cmake/intlRelease/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:53:16 tryCallOne
    /tmp/hermes/staging/hermes/cmake/intlRelease/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:139:27 anonymous
    (native) apply
    node_modules/react-native/Libraries/Core/Timers/JSTimers.js:248:12 anonymous
    node_modules/react-native/Libraries/Core/Timers/JSTimers.js:112:14 _callTimer
    node_modules/react-native/Libraries/Core/Timers/JSTimers.js:166:14 _callReactNativeMicrotasksPass
    node_modules/react-native/Libraries/Core/Timers/JSTimers.js:418:41 callReactNativeMicrotasks
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:393:6 __callReactNativeMicrotasks
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 anonymous
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:370:10 __guard
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 flushedQueue
    node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:130:11 invokeCallbackAndReturnFlushedQueue

frzkn avatar Jul 03 '23 06:07 frzkn

@frzkn any update on this thread?

naman312 avatar Sep 26 '23 11:09 naman312

Any update on this ?

Still facing the same

MaroofAhmedSiddique avatar Oct 04 '23 13:10 MaroofAhmedSiddique

@SudoPlz any updates? i'm also facing this issue

abdi4 avatar Oct 17 '23 13:10 abdi4

Guys this is a super generic issue, which I can't repro.

Essentially what this error is saying is, hey, I can't find the checkNeedsUpdate method from the native in-app-updates module. I don't know why that may be happening, it requires generic troubleshooting react-native knowledge to figure it out and my best guess would be that it's super specific to your project & environment (maybe the native module is not found for whatever reason ? expo project perhaps? fabric enabled?).

Can someone create a sample project that showcases the issue?

SudoPlz avatar Oct 17 '23 13:10 SudoPlz

I will try create a repro when time allows. As a temporary solution, I found downgrading to v1.1.0 lets me use that function without any issues (my project is on v67.5 of react native)

abdi4 avatar Oct 19 '23 09:10 abdi4

I would look at the trace at the native level, given in the stack trace above:

Caused by: java.lang.NoSuchMethodError: No interface method getAppUpdateInfo()Lcom/google/android/gms/tasks/Task; in class Lcom/google/android/play/core/appupdate/AppUpdateManager; or its super classes (declaration of 'com.google.android.play.core.appupdate.AppUpdateManager' appears in /data/app/com.dixtra.zenks.nippydelivery-4dwakNCSSSLl9bdgD3DMew==/base.apk!classes2.dex)

fabiendem avatar Oct 23 '23 15:10 fabiendem

any fix related to this issue? We are also facing same issue in rn 0.72.2

anujmpec avatar Feb 02 '24 07:02 anujmpec

any fix related to this issue? I am also facing same issue in rn 0.73.6

1712899646881

khushbu-coworks avatar Apr 12 '24 05:04 khushbu-coworks