I am planning to develop an app for emerging market with low internet bandwidth. The app heavily requires an internet connection to function.
I need this app to have a small apk size (not more than 10mb) and work on 3G network.
Based on my research if I remove x86 JS binary files from React Native the apk size could be as small as 4mb. I suppose the 4mb does not include the JS files and images so client needs to download that first time when he/she opens the app, is that correct?
Would it in general be a good idea for me to use React Native if I want an app with less than 10mb apk size that works on 3G and what are the best practices to make it efficient?

推荐答案

与其删除影响较小的js,不如使用字体和嵌入图像等二进制资源.

1) 启用Proguard:

要启用Proguard,请编辑android/app/build.格雷德尔:

def enableProguardInReleaseBuilds = true

生成单独的版本:

2) 在你的应用/构建中.梯度集

def enableSeparateBuildPerCPUArchitecture = true

3) 从过滤器中删除x86

以下是您可能会发现有用的链接参考:

关于缩小apk规模的博客:

https://realm.io/news/reducing-apk-size-native-libraries/

链接play store上最小的RN应用之一:

https://github.com/sonnylazuardi/ziliun-react-native

关于apk大小问题的有用讨论:

https://github.com/facebook/react-native/issues/5037

React-native相关问答推荐

NativeWind边框 colored颜色 在Reaction Native应用程序中未按预期工作

React Native:无法将具有 resizeMode包含的图像定位在父组件的 flex-end

React Native 应用程序没有在之前的工作代码中执行任何操作就无法运行

我如何限制 FlatList 中的元素并增加负载?

如何在 react native 中以 redux 形式设置隐藏字段?

React Native - 为什么我们对 Image 组件使用 tintColor 属性?

React Native Android:how to remove "overscroll effect" of ScrollView

react-native-snap-carousel 无法正确渲染

react-native (expo)加载markdown 文件

如何在react-navigation 中将props传递给screens/components

Invariant Violation:requireNativeComponent: "RNCWebView" was not found in the UIManager

React Redux 使用带有连接组件的 HOC

react native foreach 循环

如何在react-native 中处理不同的屏幕尺寸?

ld:找不到-lFirebaseCore clang的库: error: linker command failed with exit code 1 (use -v to see invocation)

react-native android应用程序中的underlineColorAndroid is not a valid style property错误

react-native 自动完成文本输入

react-native fetch 和基本身份验证

如何在 React Native 中等待 Alert 对话框的响应?

React Native 中的 CSS 三角形