Unable to strip the following libraries, packaging them as they are: libflutter.so
Asked Answered
M

3

6

I saw this as part of the logs generated by Gradle when building an app in release mode in flutter. Does this have any side effects on the overall app?

Montelongo answered 29/7, 2022 at 6:34 Comment(0)
A
1

libflutter.so is already the compiled form of flutter framework and other native scripts needed to run your app.

More specifically *.so files includes Dart language dependency, skia engine, flutter framework, platform related native code etc.

So their is no need to break them and compile them as they are already compiled. Hence it shows the message that cannot strip them packaging them as they are. This doesn't have any side effects. (*.so files are compiled form of code that are designed to run on linux distributions.) Android is also a linux distribution.

Hence there is no side effect on the app which you are building.

Argo answered 29/7, 2022 at 6:51 Comment(2)
The side effect is that your APK will be larger than necessary. Stripping is the process of removing compiled code that is not required for your application.Meuser
@Meuser What you say is true, but the op is asking about libflutter.so. This so file doesn't contain any information related to your code but contains flutter's engine. All of the code that we write is added in a libapp.so file. If this file is not stripped then it will have a side effect. Not in libflutter.so. And generally only libflutter.so is not stripped but flutter automatically strips the unused code on release builds. So, there are no side effects.Argo
J
0

There's a bug in AGP that causes the message: https://issuetracker.google.com/issues/353554169

However, if you are not compiling your own libraries and only package third-party libs it should not affect your apk size as the libs should be already stripped.

Jon answered 24/9 at 15:41 Comment(0)
O
0

One can add *.so to jniLibs.keepDebugSymbols, then it won't attempt to strip these:

android {
    packagingOptions {
        // Unable to strip the following libraries, packaging them as they are:
        jniLibs.keepDebugSymbols.add("**/libflutter.so")
    }
}
Outrange answered 11/10 at 17:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.