如何减少React-Native android App的大小 [英] How to decrease React-Native android App Size
问题描述
对于我的react native android应用,我编写的代码大小仅为12KB
For my react native android app, size of codes I have written is only 12KB
但是生成的软件包大小为7.9MB.我该怎么减少.
But package generated is of size 7.9MB. How can i decrease that.
根据 文档 对于本机反应,我已经在文件 app_root/android/app/proguard-rules.pro
上设置了proguard,但没有减小
As per Documentation for react native, I have already enbabled proguard on file app_root/android/app/proguard-rules.pro
but size of didn't decrease
...
android {
...
buildTypes {
release {
...
minifyEnabled true
}
}
}
...
有解决方案吗?
推荐答案
React Native应用APK包括适用于x86和ARM的JSCore二进制文件.如果不需要x86,则可以将大小减小到3-4 MB.
React Native app APKs include JSCore binaries for x86 and ARM. If you don't need x86 you could reduce the size to 3-4 MB.
1)在您的app/build.gradle设置中
1)In your app/build.gradle set
def enableSeparateBuildPerCPUArchitecture = true
2)从abiFilters删除x86
2)remove x86 from abiFilters
这帮助我将大小从7.8 mb减小到4.5 MB
this helped me in reducing size from 7.8 mb to 4.5MB
这篇关于如何减少React-Native android App的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!