Agora-Flutter-SDK icon indicating copy to clipboard operation
Agora-Flutter-SDK copied to clipboard

App size is too big

Open kameshkarthi opened this issue 3 years ago • 11 comments

Android apk size is become larger after adding agora package also i specified the target platform. before adding agora package, app size is 80mb after adding agora package, app size is >165mb

kameshkarthi avatar Jun 04 '21 06:06 kameshkarthi

you can use abifilters

LichKing-2234 avatar Jun 04 '21 07:06 LichKing-2234

Hello sir,

I tried abi filters, it only reduce 40mb. app size is still in 115mb. is there any another way to reduce size?

Thank you!

kameshkarthi avatar Jun 04 '21 07:06 kameshkarthi

In android native, I tried abiFilters and it reduced size exceptionally

ndkVersion rootProject.ext.ndkVersion
    defaultConfig {
       .........

        ndk {
            abiFilters 'arm64-v8a', 'x86_64'
        }
}

AliAzaz avatar May 12 '22 19:05 AliAzaz

Also can reduce the size using this filter

defaultConfig { ......... ndk { abiFilters 'arm64-v8a', 'armeabi-v7a' } }

kumar8983 avatar May 24 '22 10:05 kumar8983

还有其他可以减小app size 的方法吗? ndk { abiFilters 'armeabi-v7a', 'arm64-v8a'//, 'x86' } 这两个平台打包后,Agora的大小至少在 32M,还是挺大的了,如何去除不需要的依赖库呀?

截屏2022-06-13 13 10 19

good-good-study avatar Jun 13 '22 05:06 good-good-study

@LichKing-2234 @good-good-study is there any way to reduce agora size on flutter? quit large even applying with abi filters.

user97116 avatar Jul 25 '22 07:07 user97116

Any update on this issue?

MrunalrajRedij avatar Aug 05 '22 15:08 MrunalrajRedij

Hey, i have some solution for your guys.. Before finding the tricky, im very desperate with this plugin while reducing the app size. Tested on (Android), Step to produce:

  1. Find build.gradle from your agora package. Example dir: C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\agora_rtc_engine-5.3.0\android\build.gradle
  2. Search and comment api 'io.agora.rtc:full-sdk:VERSION'
dependencies {
  if (isDev(project)) {
    api fileTree(dir: "libs", include: ["*.jar", "*.aar"])
  } else {
    // api 'io.agora.rtc:full-sdk:3.7.0.3' (Comment this)
    api 'io.agora.rtc:iris-rtc:3.7.0.3'
  }
}
  1. Add your specific library by following this https://docs.agora.io/en/Interactive%20Broadcast/reduce_rtc_app_size?platform=Flutter. Since my project only need the Video & Audio without any other features, see my example code below
dependencies {
  if (isDev(project)) {
    api fileTree(dir: "libs", include: ["*.jar", "*.aar"])
  } else {
    // api 'io.agora.rtc:full-sdk:3.7.0.3'
    api 'io.agora.rtc:iris-rtc:3.7.0.3'
  }

  // implementation 'io.agora.rtc:full-screen-sharing:3.7.0.3'

  implementation 'io.agora.rtc:full-rtc-basic:3.7.0.3'
  implementation 'io.agora.rtc:full-ains:3.6.2'
  implementation 'io.agora.rtc:full-jnd:3.7.0.3'
  implementation 'io.agora.rtc:full-full-audio-format:3.6.2'
  implementation "io.agora.rtc:full-super-resolution:3.7.0.3"

  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${safeExtGet('kotlin_version', "$agora_rtc_engine_kt_version")}"
}
  1. Final, rebuild your project and see the size result.

Since you're editing the package cache it will be effect with other project. For prevent this happen, forking the package git and add manually inside pubsec.yaml

RasyidMF avatar Aug 17 '22 15:08 RasyidMF

@RasyidMF Hello my friend, first thanks for your solution, it reduced about 20 MB of my app and I have a question: you told that your project only need the Video & Audio without any other features. you mean that you have video and audio in separated way? my project just has video call feature. could you please tell me which ones should be deleted to make the apk lighter????

A-Eric-J avatar Aug 27 '22 12:08 A-Eric-J

@RasyidMF Hello my friend, first thanks for your solution, it reduced about 20 MB of my app and I have a question: you told that your project only need the Video & Audio without any other features. you mean that you have video and audio in separated way? my project just has video call feature. could you please tell me which ones should be deleted to make the apk lighter????

Check the table of documentation Click here. Searching which is used in Android Voice SDK, like example in my above code:

implementation 'io.agora.rtc:full-full-audio-format:3.6.2' // << Remove this code 

RasyidMF avatar Aug 27 '22 14:08 RasyidMF

@RasyidMF thanks for your reply, I have 2 questions:

  1. as you now my application just has Video call. if i use just this line below what will happen?

implementation 'io.agora.rtc:full-rtc-basic:3.7.0.3'

and commenting another codes like below what will happen? does it affect on my performance of video quality or video calling? please tell me about the side effets if i removing these lines in below:

implementation 'io.agora.rtc:full-ains:3.6.2' // << Removing this code implementation 'io.agora.rtc:full-jnd:3.7.0.3' // << Removing this code implementation 'io.agora.rtc:full-full-audio-format:3.6.2' // << Removing this code implementation "io.agora.rtc:full-super-resolution:3.7.0.3" // << Removing this code

because when i use just the first line it gives me 40mb apk and with all of your codes it give 58mb.(even i am using : abiFilters "arm64-v8a", "armeabi-v7a" to reduce the size.

  1. does it have another way to reduce it more(beside your solution that is helpful) for example under 35mb or 30mb? here is my code to reduce the size beside your solution:

`buildTypes { release { ndk { abiFilters "arm64-v8a", "armeabi-v7a" } signingConfig signingConfigs.release

        minifyEnabled false

        // Enables resource shrinking, which is performed by the
        // Android Gradle plugin.
        shrinkResources false
       // useProguard true


        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

` i have commented userProguard true because i had error. is this the way that i have to use or i can add more options??

thanks a lot, your solution helped me a lot🙏🙏

A-Eric-J avatar Aug 28 '22 05:08 A-Eric-J

@A-Eric-J any solutions or progress ? I just need to implement the video sdk and the app bundle size comes 130MB.

bhavykoshti avatar Feb 01 '23 13:02 bhavykoshti

@RasyidMF I did commented above dependency and my app crashys while i join the channel

bhavykoshti avatar Feb 03 '23 08:02 bhavykoshti

Hey, i have some solution for your guys.. Before finding the tricky, im very desperate with this plugin while reducing the app size. Tested on (Android), Step to produce:

  1. Find build.gradle from your agora package. Example dir: C:\tools\flutter\.pub-cache\hosted\pub.dartlang.org\agora_rtc_engine-5.3.0\android\build.gradle
  2. Search and comment api 'io.agora.rtc:full-sdk:VERSION'
dependencies {
  if (isDev(project)) {
    api fileTree(dir: "libs", include: ["*.jar", "*.aar"])
  } else {
    // api 'io.agora.rtc:full-sdk:3.7.0.3' (Comment this)
    api 'io.agora.rtc:iris-rtc:3.7.0.3'
  }
}
  1. Add your specific library by following this https://docs.agora.io/en/Interactive%20Broadcast/reduce_rtc_app_size?platform=Flutter. Since my project only need the Video & Audio without any other features, see my example code below
dependencies {
  if (isDev(project)) {
    api fileTree(dir: "libs", include: ["*.jar", "*.aar"])
  } else {
    // api 'io.agora.rtc:full-sdk:3.7.0.3'
    api 'io.agora.rtc:iris-rtc:3.7.0.3'
  }

  // implementation 'io.agora.rtc:full-screen-sharing:3.7.0.3'

  implementation 'io.agora.rtc:full-rtc-basic:3.7.0.3'
  implementation 'io.agora.rtc:full-ains:3.6.2'
  implementation 'io.agora.rtc:full-jnd:3.7.0.3'
  implementation 'io.agora.rtc:full-full-audio-format:3.6.2'
  implementation "io.agora.rtc:full-super-resolution:3.7.0.3"

  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${safeExtGet('kotlin_version', "$agora_rtc_engine_kt_version")}"
}
  1. Final, rebuild your project and see the size result.

Since you're editing the package cache it will be effect with other project. For prevent this happen, forking the package git and add manually inside pubsec.yaml

You can also use packagingOptions.exclude in your build.gradle to exclude the *extension.so which you do not need.

andorid {
    packagingOptions {
       exclude 'lib/*/libagora*extension.so'
    }
}

LichKing-2234 avatar Feb 08 '23 08:02 LichKing-2234

I have implemented the above solution but still only reduced 40mb. Is there any other solution ?

karanpatel2329 avatar Feb 21 '23 04:02 karanpatel2329

You can download the .so files at runtime in Android, I dont have specific way how to do it, but if you try and succeed please let me know too @karanpatel2329 and @LichKing-2234 I will look at your dependency structure and will let you know as my app was crashing with this custom dependency implementation

bhavykoshti avatar Feb 21 '23 04:02 bhavykoshti

You can download the .so files at runtime in Android, I dont have specific way how to do it, but if you try and succeed please let me know too @karanpatel2329 and @LichKing-2234 I will look at your dependency structure and will let you know as my app was crashing with this custom dependency implementation

Is there any way to download the .so files at runtime in Android, because i have code written in flutter.

karanpatel2329 avatar Feb 21 '23 05:02 karanpatel2329

IOS doesn't need so files so if platform is android you can download those files and agora has method to specify so files path (I have looked into the docs), and it will take so files from there to run. and yes you have to upload those files somewhere. For downloading the so files -- https://docs.agora.io/en/sdks?platform=android

bhavykoshti avatar Feb 21 '23 05:02 bhavykoshti

@LichKing-2234 Have you used the latest sdk version 6.1.0 ?, I am getting error while compiling with these changes in my code

bhavykoshti avatar Feb 22 '23 05:02 bhavykoshti

@bhavykoshti I think you can raise a new issue for your case.

littleGnAl avatar Feb 22 '23 06:02 littleGnAl

@littleGnAl https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/907

bhavykoshti avatar Feb 22 '23 06:02 bhavykoshti

@bhavykoshti if you find a solution for this issue, please revert!

hrithikm2 avatar Feb 28 '23 13:02 hrithikm2

@hrithikm2 https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/907#issuecomment-1448040532

Yeah but still looking for the ios solution

bhavykoshti avatar Feb 28 '23 13:02 bhavykoshti

is there an Ios solution

AbderraoufKhodja avatar Mar 31 '23 13:03 AbderraoufKhodja

add this following code in build.gradle module on android

splits { abi { enable true reset() include 'armeabi-v7a' universalApk false } }

NTGAli avatar Apr 29 '23 02:04 NTGAli

Please check https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/1214

littleGnAl avatar Jul 13 '23 03:07 littleGnAl

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

github-actions[bot] avatar Aug 03 '23 04:08 github-actions[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.

github-actions[bot] avatar Aug 10 '23 05:08 github-actions[bot]