Skip to content

Commit

Permalink
Clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
mieszko4 committed Oct 11, 2021
1 parent e3cc872 commit 25d0125
Showing 1 changed file with 24 additions and 45 deletions.
69 changes: 24 additions & 45 deletions docs/SIZE-REDUCTION-TIPS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

## Size Reducion Tips
## Size Reduction Tips [Android]

- Following the below steps will help you to reduce the app size by over 60%.

Expand All @@ -10,47 +10,40 @@
4. Open `AndroidManifest.xml`
and inside `application` tag

```js
```xml
<application
...
android:extractNativeLibs="true" //Add this line
android:extractNativeLibs="true" //ADD THIS LINE
...
>
...
</application>
```
5. Go to `android/app/build.gradle` & enable

`def enableSeparateBuildPerCPUArchitecture = true`
`def enableProguardInReleaseBuilds = true`
```gradle
def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = true
```

> Proguard shrinks, optimizes and obfuscates Java code. It is able to optimize bytecode as well as detect and remove unused instructions.
Now add the lines where ever i've mentioned `//Add this line`
```js
Now add the lines wherever I've mentioned `//ADD THIS LINE`
```gradle
android {
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
...
defaultConfig {
applicationId "com.zoom"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 18
resConfigs "en" //Add this line
resConfigs "en" //ADD THIS LINE
versionName "1.1.7"
multiDexEnabled true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk true // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
...
buildTypes {
debug {
Expand All @@ -59,47 +52,33 @@ android {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
shrinkResources true //Add this line
minifyEnabled true //Add this line
shrinkResources true //ADD THIS LINE
minifyEnabled true //ADD THIS LINE
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}

//Add this below snippet
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}

}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.facebook.soloader:soloader:0.9.0+' //Add this line
.
.
.
implementation 'com.facebook.soloader:soloader:0.9.0+' //ADD THIS LINE
...
}
```

## Size Reduction Tips [iOS]

For iOS follow this: [ios-reduce-your-app-size-with-app-thinning](https://agostini.tech/2019/06/02/reduce-your-app-size-with-app-thinning/)

> Make sure to set `ENABLE_BITCODE = NO;` for both Debug and Release because bitcode is not supported by Zoom iOS SDK

References :
- [zoom-reduce-app-size](https://devforum.zoom.us/t/apk-size-is-increased-after-integrate-zoom-sdk-from-20-mb-to-90-mb/5279/8?u=careerlabs),
## References
- [zoom-reduce-app-size](https://devforum.zoom.us/t/apk-size-is-increased-after-integrate-zoom-sdk-from-20-mb-to-90-mb/5279/8?u=careerlabs)
- [enable extractNativeLibs](https://devforum.zoom.us/t/apk-size-after-adding-android-zoom-sdk/16573/25?u=careerlabs)
- [How we reduced our production apk size by 70% in React Native?](https://dev.to/srajesh636/how-we-reduced-our-production-apk-size-by-70-in-react-native-1lci)
- [Reduce/Optimize React Native App Size](https://www.youtube.com/watch?v=W7boJmA7xJA&t=426)

0 comments on commit 25d0125

Please sign in to comment.