Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App size is too big #340

Closed
kameshkarthi opened this issue Jun 4, 2021 · 28 comments
Closed

App size is too big #340

kameshkarthi opened this issue Jun 4, 2021 · 28 comments
Labels
waiting for customer response waiting for customer response, or closed by no-reponse bot

Comments

@kameshkarthi
Copy link

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

@LichKing-2234
Copy link
Contributor

you can use abifilters

@kameshkarthi
Copy link
Author

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!

@AliAzaz
Copy link

AliAzaz commented May 12, 2022

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

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

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

@kumar8983
Copy link

Also can reduce the size using this filter

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

@good-good-study
Copy link

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

截屏2022-06-13 13 10 19

@user97116
Copy link

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

@MrunalrajRedij
Copy link

Any update on this issue?

@RasyidMF
Copy link

RasyidMF commented Aug 17, 2022

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

@A-Eric-J
Copy link

@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????

@RasyidMF
Copy link

@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 

@A-Eric-J
Copy link

A-Eric-J commented Aug 28, 2022

@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🙏🙏

@bhavykoshti
Copy link

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

@bhavykoshti
Copy link

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

@LichKing-2234
Copy link
Contributor

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'
    }
}

@karanpatel2329
Copy link

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

@bhavykoshti
Copy link

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

@karanpatel2329
Copy link

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.

@bhavykoshti
Copy link

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
Copy link

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

@littleGnAl
Copy link
Contributor

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

@bhavykoshti
Copy link

@littleGnAl #907

@hrithikm2
Copy link

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

@bhavykoshti
Copy link

bhavykoshti commented Feb 28, 2023

@hrithikm2
#907 (comment)

Yeah but still looking for the ios solution

@AbderraoufKhodja
Copy link

is there an Ios solution

@NTGAli
Copy link

NTGAli commented Apr 29, 2023

add this following code in build.gradle module on android

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

@littleGnAl
Copy link
Contributor

Please check #1214

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Jul 13, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

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 github-actions bot closed this as completed Aug 3, 2023
@github-actions
Copy link
Contributor

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 github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
waiting for customer response waiting for customer response, or closed by no-reponse bot
Projects
None yet
Development

No branches or pull requests