birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
135 stars 21 forks source link

How to use in Android 9 or larger? #71

Closed xiaobaicai111 closed 11 months ago

xiaobaicai111 commented 11 months ago
For Android:

In the build.gradle file set minSdkVersion equal 28 (SDK 28 — Android 9), released in August 2018), or larger.

Note: Support of older SDKs is technically possible, but it is not a priority now.

This is what I found in README, but after testing, I found that it cannot be used in Android 10 and below. How can I make it work in lower versions.

birdofpreyru commented 11 months ago

What problem did you face with Android 10 (SDK 29)? The original reason to require SDK 28+ was that lower SDK versions don’t have glob library included (maybe they also miss something else); to make it work it is possible to build missing libraries from source, either as a part of static server library build (similar to how it is done for PCRE2 lib), or prior to the static server build. Though,no idea how much effort it would take to set it up and make it work.

xiaobaicai111 commented 11 months ago

@birdofpreyru Thank you for your reply.

"react": "18.2.0",
"react-native": "0.71.13",
"@dr.pogodin/react-native-static-server": "0.8.3",

This is my RN version.In addition, my Gradle version is 7.5.1. I will reply if I solve this problem.

xiaobaicai111 commented 11 months ago

I found my problem, which was caused by my carelessness with the code. When I use webview to load html, js uses ECMAScript 6, which causes errors on android10 (android webview chrome v78). @birdofpreyru Thanks.