mikehardy / react-native-update-apk

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

ERROR TypeError: null is not an object (evaluating 'RNUpdateAPK.versionCode') #68

Closed Andreas-Sujono closed 2 years ago

Andreas-Sujono commented 2 years ago

I got this error while running this library

ERROR TypeError: null is not an object (evaluating 'RNUpdateAPK.versionCode')

it seems that it cannot read the RNUpdateAPK object from the native code

mikehardy commented 2 years ago

It seems that you have not properly rebuilt + reinstalled + relaunched your native code then Any time you get a null native object from javascript, you've integrated the project incorrectly, and that's a project-specific problem, sorry Re-do the integration, re-check you re-built everything and auto-linking worked etc, re-install it and it'll work This won't result in a change here though, I'm still using this module just fine

Andreas-Sujono commented 2 years ago

ok got it, you should add more detail in the setup guide. I need to update the header of manifest file and add the filePath XML resource

Andreas-Sujono commented 2 years ago

btw, how to test this in dev mode. I always get The signature thumbprints seem unequal. Install will fail error after installing the updated apk

mikehardy commented 2 years ago

@Andreas-Sujono "you should" --> "I'll propose a PR to the docs", because it's open source, and you're enjoying all this wonderful free stuff, please contribute back if there is a shortcoming. I contributed the code and it works great for me so I'll collaborate on PRs but I have no business case to change things at the moment. If you do, please do so

The example app is wonderfully detailed. You should treat it as documentation and use it as well. From README

Please install and run the example to see how it works before opening issues. Then adapt it into your own app. Getting the versions right is tricky and setting up FileProviders is very easy to do incorrectly, especially if using another module that defines one (like rn-fetch-blob)

https://github.com/mikehardy/react-native-update-apk/blob/8387795f3d3c4882d29101c428010e2ae722bc7d/example/App.js#L54

https://github.com/mikehardy/react-native-update-apk/blob/8387795f3d3c4882d29101c428010e2ae722bc7d/example/App.js#L105-L106

Andreas-Sujono commented 2 years ago

I won't create PR because I'm not experienced enough. that's why I created this issue. in the example, you only give warning comment and do not give how to solve it.

mikehardy commented 2 years ago

I won't create PR because I'm not experienced enough.

That's backwards! You get experience by creating PRs. Seriously! I say that in a friendly way, it's how I learned. It is similar to the saying that if you really want to learn something, try to teach it to someone...