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

Release Mode Android | couldn't find "libflutter.so" #36

Open
lance-blo opened this issue Sep 15, 2018 · 28 comments
Open

Release Mode Android | couldn't find "libflutter.so" #36

lance-blo opened this issue Sep 15, 2018 · 28 comments
Labels
under investigation under investigation

Comments

@lance-blo
Copy link

lance-blo commented Sep 15, 2018

Hi all,

I'm having an issue when using the library and building a release apk for Android.

flutter -v doctor

[√] Flutter (Channel beta, v0.7.3, on Microsoft Windows [Version 10.0.17134.285], locale fr-FR)
• Flutter version 0.7.3 at C:\Users\lance\Dev\SDK\flutter
• Framework revision 3b309bda07 (3 weeks ago), 2018-08-28 12:39:24 -0700
• Engine revision af42b6dc95
• Dart version 2.1.0-dev.1.0.flutter-ccb16f7282

[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
• Android SDK at C:\Users\lance\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.

[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 28.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] IntelliJ IDEA Community Edition (version 2018.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.5
• Flutter plugin version 28.0.4
• Dart plugin version 182.4323.44

[√] Connected devices (1 available)
• ONEPLUS A3003 • 94e1fa9b • android-arm64 • Android 8.0.0 (API 26)

• No issues found!

Reproduce issue

  1. Create an empty flutter project

  2. Replace main.dart with

https://pub.dartlang.org/packages/mlkit#-example-tab-

  1. Update pubspec.yaml to

mlkit: ^0.6.2 image_picker:

  1. run $ flutter build apk

  2. I am getting the following

AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/eu.my-domain.mlkit-test-VnjMxahfeCGMItX8kAUbAg==/base.apk"],nativeLibraryDirectories=[/data/app/eu.my-domain.mlkit-test-VnjMxahfeCGMItX8kAUbAg==/lib/arm64, /data/app/eu.my-domain.mlkit-test-VnjMxahfeCGMItX8kAUbAg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]] couldn't find "libflutter.so"

This seems to be linked to
flutter/flutter#18939
flutter/flutter#18494

Any ideas why this is hapenning?

@sayurikunugi
Copy link

Hi,

when you build apk, try the command.
flutter build apk --release --target-platform android-arm64

if you still have the same 'couldn't find "libflutter.so"' error,
your device could be 32bit.

in that case, change your android build.gradle file something like below.
build.gradle
defaultConfig {
ndk{
abiFilters "armeabi-v7a"
}

}

and try the command below.
flutter build apk --release --target-platform android-arm

@lance-blo
Copy link
Author

Thanks. Right, as described here flutter/issues/18939, this makes the app run.

But my problem is that I will not be able to publish the app to the PlayStore as I will be targeting only one architecture.

I have tested several other plugins that are not creating the described problem.

Any ideas as to why this is happening?

@azihsoyn
Copy link
Owner

Hi, Thanks reporting and commenting!

I'll check it later ASAP! 😄

@azihsoyn azihsoyn added the under investigation under investigation label Sep 15, 2018
@sayurikunugi
Copy link

that's true.
my app works fine both for 64-bit and 32-bit, when using 32bit build.
how about yours?

@lance-blo
Copy link
Author

Ok after several testing I have the below (my device is 64-bit).

Targeting 64-bit architecture does work.
flutter build apk --release --target-platform android-arm64

However targeting 32-bit reproduces the issue.
flutter build apk --release --target-platform android-arm

To get the 32-bit version running I need to use:
defaultConfig { ndk{ abiFilters "armeabi-v7a" } }

@Albert221
Copy link

Is there any update on this?

@azihsoyn
Copy link
Owner

Hi, @Albert221

#36 (comment) does not resolve your issue?

@RockCoder7
Copy link

Hi,

when you build apk, try the command.
flutter build apk --release --target-platform android-arm64

if you still have the same 'couldn't find "libflutter.so"' error,
your device could be 32bit.

in that case, change your android build.gradle file something like below.
build.gradle
defaultConfig {
ndk{
abiFilters "armeabi-v7a"
}

}

and try the command below.
flutter build apk --release --target-platform android-arm

This works for me! Thank you sooooooooo much!

@phaylali
Copy link

phaylali commented Jan 3, 2019

Ok after several testing I have the below (my device is 64-bit).

Targeting 64-bit architecture does work.
flutter build apk --release --target-platform android-arm64

However targeting 32-bit reproduces the issue.
flutter build apk --release --target-platform android-arm

To get the 32-bit version running I need to use:
defaultConfig { ndk{ abiFilters "armeabi-v7a" } }

hey , so first thank you , second does that mean I have to produce two different apks? or the first command is enough for the two versions ?
EDIT : arm-64 is backwards compatible , so using the abifilters and choosing only armeabi-v7a will work on all devices , unless you have an app that uses something specific to arm64 devices , then you have to make two apks , an apk for every platform, I guess you can declare this issue as solved

@kelvinji2009
Copy link

@afamobius What's your minSdkVersion?

@shoxter
Copy link

shoxter commented Jan 19, 2019

@afamobius So is it backwards compatible without defaultConfig { ndk{ abiFilters "armeabi-v7a" } } or you needed that for it to be backwards compatible?

@dhaval0122
Copy link

any solution? i have upgrade flutter to 1.7.4 still app crash while open.

@nimesh1997
Copy link

After Upgraded flutter to 1.7.4 new error comes how to resolve this in flutter version?

> **/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_image-1.0.0/lib/network.dart:75:31: Error: The argument type 'Null Function(StringBuffer)' can't be assigned to the parameter type 'Iterable<DiagnosticsNode> Function()'.
>  - 'StringBuffer' is from 'dart:core'.                                  
>  - 'Iterable' is from 'dart:core'.                                      
>  - 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart'**

_

@amreniouinnovent
Copy link

this works for me
defaultConfig {
ndk {
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
}
}

@marvinsxtr
Copy link

After none of the solutions above worked for me, i looked into the documentation and found that it worked fine when i ran
flutter build apk --split-per-abi
and picked the release-apk corresponding to my system architecture.

@kw2019ltd
Copy link

still getting same issue with new flutter version even the pp bundle contin both 32 and 64

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/kw.ltd.instagram_app-qzaBIcobpGp9vljkJD7Y1Q==/base.apk"],nativeLibraryDirectories=[/data/app/kw.ltd.instagram_app-qzaBIcobpGp9vljkJD7Y1Q==/lib/arm64, /system/lib64, /vendor/lib64, /system/product/lib64]]] couldn't find "libflutter.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1067)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at io.flutter.embedding.engine.loader.FlutterLoader.startInitialization(FlutterLoader.java:122)
at io.flutter.embedding.engine.loader.FlutterLoader.startInitialization(FlutterLoader.java:93)
at io.flutter.view.FlutterMain.startInitialization(FlutterMain.java:45)
at io.flutter.app.FlutterApplication.onCreate(FlutterApplication.java:22)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1189)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

@aldwnesx
Copy link

still getting same issue with new flutter version even the pp bundle contin both 32 and 64

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/kw.ltd.instagram_app-qzaBIcobpGp9vljkJD7Y1Q==/base.apk"],nativeLibraryDirectories=[/data/app/kw.ltd.instagram_app-qzaBIcobpGp9vljkJD7Y1Q==/lib/arm64, /system/lib64, /vendor/lib64, /system/product/lib64]]] couldn't find "libflutter.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1067)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at io.flutter.embedding.engine.loader.FlutterLoader.startInitialization(FlutterLoader.java:122)
at io.flutter.embedding.engine.loader.FlutterLoader.startInitialization(FlutterLoader.java:93)
at io.flutter.view.FlutterMain.startInitialization(FlutterMain.java:45)
at io.flutter.app.FlutterApplication.onCreate(FlutterApplication.java:22)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1189)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6460)
at android.app.ActivityThread.access$1300(ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Same..

@aldwnesx
Copy link

this works for me
defaultConfig {
ndk {
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
}
}

do you run build appbundle or apk or splitapk
?

@kw2019ltd
Copy link

kw2019ltd commented Mar 28, 2020 via email

@Dvl-es
Copy link

Dvl-es commented Apr 3, 2020

Hello. Trying to build flutter app for x86 32 bit, but libflutter.so is not generated.
How can i fix this?

armv7, arm46 and x86_64 are generated without issues

@devDeejay
Copy link

Any fixes guys :( ?

@z85510
Copy link

z85510 commented Jun 11, 2020

I have the same problem.
I've tried to add

ndk{
abiFilters "armeabi-v7a"
}

but after adding this line in build.gradle then my app doesn't work on x86 emulators.

@emadd
Copy link

emadd commented Jun 14, 2020

Getting this in production. Not cool.

Fatal Exception: java.lang.UnsatisfiedLinkError
dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.seachangedigital.quiverus-1/base.apk"],nativeLibraryDirectories=[/data/app/com.seachangedigital.quiverus-1/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libflutter.so"
java.lang.Runtime.loadLibrary0 (Runtime.java:984)
java.lang.System.loadLibrary (System.java:1582)
io.flutter.embedding.engine.loader.FlutterLoader.startInitialization
io.flutter.embedding.engine.loader.FlutterLoader.startInitialization
io.flutter.view.FlutterMain.startInitialization
io.flutter.app.FlutterApplication.onCreate
android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1024)
android.app.ActivityThread.handleBindApplication (ActivityThread.java:5405)
android.app.ActivityThread.-wrap2 (ActivityThread.java)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1546)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6121)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:889)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:779)

Firebase Crashlytics says the devices are Android 7.1.2 (TaintArt for x86) and 8.1.0 (Nexus 5X)

@premtemp1
Copy link

Getting the same error as @emadd ..
any solution
this my filter setting --
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'

@rlecheta
Copy link

I'm integrating flutter in some existing app and I have the same error
/base.apk!/lib/x86_64, /system/lib64]]] couldn't find "libflutter.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
at java.lang.System.loadLibrary(System.java:1669)
And this doesn't solve the problem:
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
}
I can build a release apk, but I can't run it on emulador using Android Studio.

@uzumaki258
Copy link

I have the same issue with Android 5.1 and 5.1.1:
nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libflutter.so"
I have used it.
buildTypes {
release {
// other configs
ndk {
abiFilters 'armeabi-v7a','arm64-v8a','x86_64'
}
signingConfig signingConfigs.release
}
targetSdkVersion 29

@DaBlitzStein
Copy link

Same here, tested all configurations proposed. 2 years and still open.

@blamath20
Copy link

Still not working...missing libflutter.so from x86 Flutter 2.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
under investigation under investigation
Projects
None yet
Development

No branches or pull requests