mikehardy / react-native-update-apk

Update apk from non-play store servers, and update ios from app store in React Native.
MIT License
195 stars 57 forks source link

deprecated PackageManager.getPackageInfo(String, int) causing crashes in android 13 devices. #77

Open vrnDhmn opened 1 year ago

vrnDhmn commented 1 year ago

ERROR:

Attempt to read from field 'java.lang.String android.content.pm.PackageInfo.versionName' on a null object reference in method 'void net.mikehardy.rnupdateapk.RNUpdateAPK.getApkInfo(java.lang.String, com.facebook.react.bridge.Promise)'

Stacktrace

RNUpdateAPK.java:113 net.mikehardy.rnupdateapk.RNUpdateAPK.getApkInfo
Method.java:-2 java.lang.reflect.Method.invoke
JavaMethodWrapper.java:372 com.facebook.react.bridge.JavaMethodWrapper.invoke
JavaModuleWrapper.java:188 com.facebook.react.bridge.JavaModuleWrapper.invoke
NativeRunnable.java:-2 com.facebook.react.bridge.queue.NativeRunnable.run
Handler.java:942 android.os.Handler.handleCallback
Handler.java:99 android.os.Handler.dispatchMessage
MessageQueueThreadHandler.java:27 com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage
Looper.java:240 android.os.Looper.loopOnce
Looper.java:351 android.os.Looper.loop
MessageQueueThreadImpl.java:226 com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run
Thread.java:1012 java.lang.Thread.run
node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:106:59 promiseMethodWrapper
node_modules/rn-update-apk/index.js:127:30 anonymous
/tmp/hermes/staging/hermes/cmake/intlRelease/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:53:16 tryCallOne
/tmp/hermes/staging/hermes/cmake/intlRelease/arm64-v8a/lib/InternalBytecode/InternalBytecode.js:139:27 anonymous
(native) apply
node_modules/react-native/Libraries/Core/Timers/JSTimers.js:248:22 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:41 __callReactNativeMicrotasks
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:38 anonymous
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:370:10 __guard
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:16 flushedQueue
node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:130:28 invokeCallbackAndReturnFlushedQueue

Devices

Coming to 200 of our users mostly on android 13 Screenshot 2023-04-05 at 4 01 38 PM Screenshot 2023-04-05 at 4 03 24 PM

Links

https://stackoverflow.com/questions/73388061/android-13-sdk-33-packagemanager-getpackageinfostring-int-deprecated-what https://github.com/Baseflow/flutter-permission-handler/issues/851#issuecomment-1156649193

mikehardy commented 1 year ago

Happy to accept PRs and merge + release them, I haven't gotten around to building with API33 yet for the one app I have that uses this, so it is not a priority for me at the moment.

mikehardy commented 1 year ago

My main device, where I use this feature in my app, is still Android 11 so I haven't seen this

You can thumbs down my comment about needing PRs all you want but THIS IS OPEN SOURCE

It is not "Hey, the whole internet should create free software for me and I don't have to do anything"

You'll have to check your sense of expectation and entitlement and do some work sometimes if you need features

And you certainly should not be thumbs-downing and upset with maintainers who don't do all your work for you for free!

Amazing