tencent cloud

Feedback

How to Downsize Installation Package

Last updated: 2023-10-13 11:21:36

    How much will the file increment be after the TRTC SDK is integrated?

    The file size increment varies by TRTC SDK version. For more information, please see SDK Download.
    

    How do I reduce the size of an installation package for iOS?

    Method 1. Only package the ARM64 architecture (recommended)
    Method 2. Enable Bitcode
    For iPhone models after 5s, you can just package x64 architecture by setting "Build Active Architecture Only" in "Build Settings" in Xcode to "Yes" and write only arm64 into "Valid Architectures". The single-architecture IPA increment of the TRTC SDK will be 1.9 MB only.
    
    
    For iPhone 5s and older models, if all third-party libraries in the project support Bitcode, you can enable Bitcode to reduce the size of the installation package. Toggle on "Enable Bitcode" in "Build Settings" > "Build Options" to enable bitcode.
    
    From 2016 on, Apple started to support Bitcode compilation in the Xcode development environment. After Bitcode is enabled, the compiler will generate the application's intermediate code instead of the actual assembly code, and users will download and install the machine code generated for the specific mobile CPU architecture from App Store, which greatly reduces the installation package size.
    

    How do I reduce the size of an installation package for Android?

    Method 1. Only package certain .so files
    Method 2. Only package JAR files (i.e., .so files will be downloaded after installation)
    If your application is used in the Chinese mainland only, you can just package the .so files for the armeabi-v7a architecture to reduce the increment in the installation package size to below 5 MB. If you want to offer your application on Google Play, you can package the .so files for the armeabi-v7a and arm64-v8a architectures. Directions: add abiFilters "armeabi-v7a" to build.gradle of the current project to specify to package the .so files in a single architecture only or add abiFilters "armeabi-v7a","arm64-v8a" to specify to package .so files in two architectures.
    If only .so files in armeabi-v7a architecture are packaged (i.e., your application is not offered on Google Play):
    
    
    If .so files in armeabi-v7a and arm64-v8a architectures are packaged (i.e., your application is offered on Google Play):
    
    
    notice
    If you want to offer your application on Google Play, please do not use this method, as it may cause a failure in offering the application.
    The size of .so files takes the greatest proportion of the total size of the SDK for Android. If you want to reduce your installation package to below 1 MB, you can use the method of downloading .so files after installation:
    1. In the folder on GitHub, click and download the package named in the format of LiteAVSDK_TRTC_x.x.xxx.zip, decompress it, and find the .so files for the specified architecture.
    2. Upload the .so files downloaded in step 1 to your server (or Tencent Cloud COS) and record the download address such as http://xxx.com/so_files.zip.
    3. Before an SDK feature such as video playback is started by the user, use a loading animation to prompt the user that the relevant feature module is being loaded. When the user is waiting, the application can download the .so files from http://xxx.com/so_files.zip and store the files in the application directory (such as the files folder in the application's root directory). To ensure that this process is not affected by ISP DNS hijacking, please verify the integrity of the .so files after download to check whether the zip package has been tampered with the ISP.
    4. After all .so files are ready, call the setLibraryPath() API in the TXLiveBase class (the earliest basic module of LiteAVSDK) to set the target paths of the downloaded .so files to the paths in the SDK, so that the SDK can load the required .so files at those paths and start the relevant features.
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support