Agora-Flutter-SDK
Agora-Flutter-SDK copied to clipboard
App size is too big
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
you can use abifilters
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!
In android native, I tried abiFilters and it reduced size exceptionally
ndkVersion rootProject.ext.ndkVersion
defaultConfig {
.........
ndk {
abiFilters 'arm64-v8a', 'x86_64'
}
}
Also can reduce the size using this filter
defaultConfig { ......... ndk { abiFilters 'arm64-v8a', 'armeabi-v7a' } }
还有其他可以减小app size 的方法吗? ndk { abiFilters 'armeabi-v7a', 'arm64-v8a'//, 'x86' } 这两个平台打包后,Agora的大小至少在 32M,还是挺大的了,如何去除不需要的依赖库呀?
@LichKing-2234 @good-good-study is there any way to reduce agora size on flutter? quit large even applying with abi filters.
Any update on this issue?
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:
- 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
- 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'
}
}
- 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")}"
}
- 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 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 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 thanks for your reply, I have 2 questions:
- 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.
- 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 any solutions or progress ? I just need to implement the video sdk and the app bundle size comes 130MB.
@RasyidMF I did commented above dependency and my app crashys while i join the channel
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:
- 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
- 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' } }
- 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")}" }
- 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'
}
}
I have implemented the above solution but still only reduced 40mb. Is there any other solution ?
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
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.
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
@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 I think you can raise a new issue for your case.
@littleGnAl https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/907
@bhavykoshti if you find a solution for this issue, please revert!
@hrithikm2 https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/907#issuecomment-1448040532
Yeah but still looking for the ios solution
is there an Ios solution
add this following code in build.gradle module on android
splits { abi { enable true reset() include 'armeabi-v7a' universalApk false } }
Please check https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK/issues/1214
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.
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.