Closed bulaxy closed 4 years ago
How did the example work for you? Make sure it works first. What was in logcat? You will want to have logcat running every time you are working on features related to this module as all the interesting stack traces only show up there.
I have tried the example before I tried to implement this api. The example code it works for me until after the app reinstalled and the message "App installed. Done/Open" Only when I try to open the re-installed example file, it have the error React Native Version Mismatch. I didnt look into that too detail since I didnt look too much into the apk file the example downloaded.
I realize the error I posted up at the start was due to a mistake in .json apkURL, but after changes, still have the very similar error message appeared (difference cause) Here is the logcat session of what I think is related.
Here is the error message from example
Please don't post screenshots. Post the text of the errors inside triple-backticks so they are formatted nicely.
Only when I try to open the re-installed example file, it have the error React Native Version Mismatch. I didnt look into that too detail since I didnt look too much into the apk file the example downloaded.
Details are vital, you should look into them - this happens because of something documented: https://github.com/mikehardy/react-native-update-apk/blob/48f6aee23bbd93b92be30b06d098ca78176193e4/example/App.js#L51-L52
The second one is visible in logcat. I can't paste it because you posted an image. But it is a certificate mismatch. If you use different keystores to sign the APK of the same bundle-id, then the system will think the APKs are from a different developer and then it is not an "upgrade", it's an attempted hijacking the system blocks.
The final one is related to the example App.js trying to access APIs that don't exist in the underlying java code, probably related to not turning off local package server or similar.
All I can say is I use this in a deployed app and it definitely works for me, but testing it is very difficult.
I got the example working great, I thought I stopped the server
the certificate I have tried, even if the certificate was identical, it gave the same error.
I decided to make a new project new key new apk etc, it got the same error.
I have tried to update the app through importing the apk and install the apk through terminal, and it works, so I dont think the update process is the issue.
2019-11-25 07:11:58.779 23035-23075/com.t1 I/SystemConfig: Adding association: com.google.android.as <- com.android.providers.contacts
2019-11-25 07:11:58.780 23035-23075/com.t1 I/SystemConfig: Adding association: com.google.android.as <- com.android.providers.media
2019-11-25 07:11:58.780 23035-23075/com.t1 I/SystemConfig: Adding association: com.google.android.as <- com.android.providers.telephony
2019-11-25 07:11:58.780 23035-23075/com.t1 I/SystemConfig: Adding association: com.google.android.as <- com.android.systemui
2019-11-25 07:11:58.780 23035-23075/com.t1 I/SystemConfig: Adding association: com.google.android.as <- com.google.android.gms
2019-11-25 07:11:58.780 23035-23075/com.t1 I/SystemConfig: Adding association: com.google.android.as <- com.google.android.gsf
2019-11-25 07:11:58.793 23035-23075/com.t1 W/SystemConfig: No directory /product_services/etc/sysconfig, skipping
2019-11-25 07:11:58.793 23035-23075/com.t1 W/SystemConfig: No directory /product_services/etc/permissions, skipping
2019-11-25 07:11:58.900 23035-23074/com.t1 I/ReactNativeJS: RNUpdateAPK::downloadApk - Old Cert SHA-256: 31abf2c12ca6c9d8e19bb7042ba29c46fccaddf3ce728334182aa553ea15a30e
2019-11-25 07:11:58.900 23035-23074/com.t1 I/ReactNativeJS: RNUpdateAPK::downloadApk - New Cert SHA-256: 31abf2c12ca6c9d8e19bb7042ba29c46fccaddf3ce728334182aa553ea15a30e
2019-11-25 07:11:58.900 23035-23075/com.t1 E/RNUpdateAPK: installApk exception with authority name 'com.t1'
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:605)
at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:579)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:417)
at net.mikehardy.rnupdateapk.RNUpdateAPK.installApk(RNUpdateAPK.java:142)
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:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:214)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:919)
2019-11-25 07:11:58.902 23035-23075/com.t1 E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.t1, PID: 23035
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:605)
at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:579)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:417)
at net.mikehardy.rnupdateapk.RNUpdateAPK.installApk(RNUpdateAPK.java:142)
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:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:214)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:919)
2019-11-25 07:11:58.914 23035-23075/com.t1 I/Process: Sending signal. PID: 23035 SIG: 9
Saw online people commented FATAL EXCEPTION: mqt_native_modules
was caused by some release build of apk issues so I tried using debug build
which give me error on the same location, but difference message
2019-11-25 09:00:20.280 25176-25458/com.t1 I/ReactNativeJS: downloadApkProgress callback called - 100%...
2019-11-25 09:00:20.315 25176-25458/com.t1 I/ReactNativeJS: RNUpdateAPK::downloadApk - downloadApkEnd
2019-11-25 09:00:20.315 25176-25458/com.t1 I/ReactNativeJS: downloadApkEnd callback called
2019-11-25 09:00:20.436 25176-25459/com.t1 E/RNUpdateAPK: installApk exception with authority name 'com.t1'
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:605)
at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:579)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:417)
at net.mikehardy.rnupdateapk.RNUpdateAPK.installApk(RNUpdateAPK.java:142)
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:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:214)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:919)
2019-11-25 09:00:20.437 25176-25458/com.t1 I/ReactNativeJS: RNUpdateAPK::downloadApk - Old Cert SHA-256: 18dbed4557c517008ed69dd087ce8392a470eb963d8db347d04e3123ff21c894
2019-11-25 09:00:20.437 25176-25458/com.t1 I/ReactNativeJS: RNUpdateAPK::downloadApk - New Cert SHA-256: 18dbed4557c517008ed69dd087ce8392a470eb963d8db347d04e3123ff21c894
2019-11-25 09:00:20.437 25176-25459/com.t1 E/unknown:ReactNative: Exception in native call
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
at androidx.core.content.FileProvider.parsePathStrategy(FileProvider.java:605)
at androidx.core.content.FileProvider.getPathStrategy(FileProvider.java:579)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:417)
at net.mikehardy.rnupdateapk.RNUpdateAPK.installApk(RNUpdateAPK.java:142)
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:158)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:214)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:232)
at java.lang.Thread.run(Thread.java:919)
2019-11-25 09:00:20.462 25176-25176/com.t1 D/ReactNative: CatalystInstanceImpl.destroy() start
2019-11-25 09:00:20.501 25176-25473/com.t1 D/ReactNative: CatalystInstanceImpl.destroy() end
2019-11-25 09:00:20.521 25176-25209/com.t1 D/EGL_emulation: eglMakeCurrent: 0xe081be60: ver 2 0 (tinfo 0xe0802e00)
2019-11-25 09:00:20.532 25176-25176/com.t1 W/unknown:ReactNative: Tried to enqueue runnable on already finished thread: 'js... dropping Runnable.
I had no doubt that it works, I just think I am stupid and making some mistake that I couldnt find.
I've seen that error before and it's still a filepaths local setup issue. Not a problem with the module. Be very very careful with AndroidManifest and your providers file.
Error due to carelessness. Apologize for wasting your time.
No worries - I'm sure there are actual bugs in here, there always are! Glad you got it working though - I'm able to officially deliver my production app via the play store now so I don't strictly need it, but I use it for delivery on my testing environments and it sure is quick+easy... Cheers
The App crash after pressing UPDATE on update available pop-up
filepaths.xml
AndroidManifest.xml