Flutter app drops java.lang.UnsatisfiedLinkError (couldn't find “libflutter.so”) Flutter (Channel unknown, v1.12.13+hotfix.9) - flutter

i see below error on crashlytics firebase a lot on many different devices for me its not reproduced.
flutter team not able to solve this issue
https://github.com/flutter/flutter/issues/37566
Flutter (Channel unknown, v1.12.13+hotfix.9):
note: the apk contain the libflutter.so binaries.
Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/kw.ltd.twitter_app-1/base.apk"],nativeLibraryDirectories=[/data/app/kw.ltd.twitter_app-1/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libflutter.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:984)
at java.lang.System.loadLibrary(System.java:1582)
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:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5405)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

Have you tried building with this command:
flutter build apk --target-platform android-arm64
This worked for me!

Finally, i find the solution!
1.add target-platform=android-arm in gradle.properties
2.edit build.gradle in your root folder
rootProject.setProperty('target-platform', 'android-arm')
subprojects {
project.setProperty('target-platform', 'android-arm')
}

Related

(unknown SDK "flutter´")

not understand why not compiled my project in flutter, when compile it show this.
the path is good in the environment of variable the sdk of flutter is good
[teimprimimos] dart pub get
Resolving dependencies...
Because teimprimimos depends on flutter from sdk which doesn't exist (unknown SDK "flutter´"), version solving failed.
It's a late answer but I encountered recently that's why answering here. In your pubspec.yaml where spelling of flutter sdk under dependencies or dev_dependencies.

ui.TextLeadingDistribution not found when running Flutter app on chrome or macos

When trying to run my app on chrome or macos after using dart migrate, I get this errors in the console:
Downloading Web SDK... 2,674ms
Launching lib/web/main.dev.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:38:7: Error: Type 'ui.TextLeadingDistribution' not found.
ui.TextLeadingDistribution? leadingDistribution,
^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:98:7: Error: Type 'ui.TextLeadingDistribution' not found.
ui.TextLeadingDistribution? leadingDistribution,
^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:219:3: Error: Type 'ui.TextLeadingDistribution' not found.
ui.TextLeadingDistribution? get leadingDistribution =>
It runs fine on the Android / iPhone emulators.
I tried the following but all in vain:
flutter 2.0.6 (stable)
flutter 2.5.3 (stable)
flutter doctor shows nothing wrong
flutter clean, flutter pub cache repair, flutter pub get
Restart VSCode
Actually, the issue was coming from the dependency styled_text.
I copied only the files that we needed from the repo and that solved the issue.

Warning: File C:\Users\UserName\.android\repositories.cfg could not be loaded. ( didn't work this command "flutter doctor --android-licenses")

I've been trying to solve this error since one day.
First I got this error
Exception: Android sdkmanager tool not found (/ usr / lib / android-sdk / tools / bin / sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
Here is a Screenshot
I tried to solve this error but couldn't solve it and I deleted Android Studio completely (sdk, gradle, .android ... etc). I reinstalled and flutter I got this error when I wrote doctor. New errors Screenshot
C:\Users\Fatihh>flutter doctor --android-licenses
Warning: File C:\Users\Fatihh\.android\repositories.cfg could not be loaded.
4 of 7 SDK package licenses not accepted. 100% Computing updates...
Review licenses that have not been accepted (y/N)?
C:\Users\Fatihh>
Finally I made the decision to write here. I need help.
Android studio version:4.1.1
OS :Win 10
Flutter SDK :1.22.5
Android SDK:30.3
First, open Android Studio and install Flutter and Dart plugins on it.
Then run the command flutter doctor --android-licenses
Finally, clean your project, make sure packages are installed and run it
flutter clean
flutter pub get
flutter run

The built failed likely due to AndroidX incompatibilities in a plugin,for plugin Workmanager in Flutter

I wanted to run a background process in flutter.I used the code in https://pub.dev/packages/workmanager#-example-tab- and added the dependency required in pubspec.yaml file.
But I am getting "The built failed likely due to AndroidX incompatibilities in a plugin".The detail of the which I am sharing in the screenshot below(2 images):
I tried checking my gradle.properties file as suggested in some posts.But useAndroidX,enableJetifier were set "true".The details of gradle.properties is below:
android.useAndroidX=true
android.enableJetifier=true
This is my flutter doctor -v details:
The flutter build --verbose
I recently got this error, while using cloud_firestore plugin.
Since, Starting from Flutter v1.12.13, new projects created with flutter use AndroidX by default, therefore that didn't solve my problem.
After several times doing Pub get with any versions of plugin,
I figured all you have to do is:
• Go to android/app/build.gradle of your Flutter project, and
• Set minSdkVersion 21
Now, on running flutter build apk, the error should go away.
you just need to migrate to AndroidX maybe
https://flutter.dev/docs/development/androidx-migration
refer this link, please

Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds

Log:
E:\Flutter>flutter doctor Checking Dart SDK version... Downloading
Dart SDK from Flutter engine ead227f a... Unzipping Dart SDK...
Updating flutter tool... Error: Unable to 'pub upgrade' flutter tool.
Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub
upgrade' flutter tool. Retrying in five seconds...
First Make sure you have a working internet connection and if this issue still exists then, this error may be because the dart sdk may have not been properly downloaded.
The simplest solution is to delete the cache folder located in
flutter/bin(location where flutter is installed) and then Run flutter doctor
I fix that by:
Ctrl+C to stop infinite error loop.
Kill the Dart process in Windows Task Manager.
Delete the cache folder located in flutter/bin directory.
Run in command line flutter pub cache repair.
After that I run flutter doctor and get predictable results:
e:\tools>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version
6.1.7601], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.44.2)
[√] Connected device (1 available)
! Doctor found issues in 2 categories.
I found my antivirus blocks pub upgrade,I had same issue while hitting flutter doctor, I turned off my antivirus and tried to run "flutter doctor" again, and worked well!
windows:
simplest and easiest way is download the latest version flutter sdk. replace manually current folder by pasting downloaded flutter folder instead of the current folder
in c drive. always choose replace and paste.
after finishing that check with flutter doctor. my issue solved
Solved this issue when Run the CMD as administrative.
This issue will come in protected network as well as due to anti-virus. Even I was facing the same. I downloaded latest stable version manually from the following link, which doesn't required any update process and it works for now..
Download Link For Flutter in Zip format
I updated the flutter SDK via git pull, then the flutter doctor command works.
Just delete the cache folder in flutter/bin and run flutter doctor again!!
Just Deactivate your antivirus and run it again. It would work fine. I had the same issue before.
I deactivated my antivirus for some time and executed flutter doctor command once again in cmd and got fruitful results after hours of patience.
One more thing to note, you should ensure that path of dart-sdk folder should be added to the path in user variables.
It seems it is not being able to "unzip" the downloaded Dart file because it misses 7-zip uncompressor.
I installed it and it worked! It will deal with .7z files.
I hope it works for other people too!!
I had the same problem and it was solved.
Steps:
Download Dart and Filters SDK then Decompress these files and move them to this directory.
C: \
Define the variables in path:
Delete cache directory in flutter/bin
Then run flutter doctor
Make sure you downloaded the windows powershell i use windows 8 it wasn't installed by default , when i downloaded it it worked for me.
Check your flutter bin path in environment variable(User Variables). If not go to Under User variables check if there is an entry called Path:in that add this flutter/bin path.
Strangly when I kill the dart process in Windows Task Manager it is working. But sometimes even when dart process is running update working.
I had to turn off the Android Emulator. It was running for me...
I got the same error and was not able to get rid of it. So I deleted the flutter and instead of cloning it I downloaded the zip from the flutter website and extracted it. Now it works just fine.
Manually downloading the SDK from flutter website fixed the issue.
Still dont know why this problem occured tho.
If you are using Avast (or possibly some other anti virus too) on Mac and have recently updated the OS to Big Sur then follow the below steps to fix this issue
Open Avast and in the Web Shield area disable the "Scan secure connection".
Run flutter config --no-analytics and then run pub upgrade.
This should probably fix the issue.
You can also refer to below threads in Github for more details about the cause
https://github.com/flutter/flutter/issues/40515
https://github.com/flutter/flutter/issues/68999
In my case, the error resolve after adding below folder into exclude option in anti virus
Flutter SDK location
D:\Android\flutter_windows\flutter\*.
Flutter Local Pub folder
C:\Users\hitesh\AppData\Local\Pub
You get the error --
"Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (1 tries left)" even if you are in one of the flutter directories from Windows explorer. Close the window and try running Flutter doctor. This will resolve.
If anyone faces this problem on macOS with AdGuard installed. Try this:
Go AdGuard Preferences -> Network -> Automatically filter applications -> Select Mode... and change mode to Automatic Proxy.
Pub failed to delete entry because it was in use by another process.
This may be caused by a virus scanner or having a file
in the directory open in another application.
Error (1): Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
Tried switch to Dev channel and got stuck with "Unable to pub upgrade". Did everything and nothing worked.
This is what I did:
Renamed the Flutter SDK folder
Download the latest Flutter SDK
Extract to the same location of previous renamed SDK
Flutter channel Dev
Flutter upgrade
And everything back to normal.
Source of Problem
It might be possible that you don't have enough free disk space. That's what caused my problems to begin with.
Solution
In my case,
First I had to clean up space to remove any unused files.
Then I had to overwrite the flutter SDK folder due to corruption. The SDK can be found here.
I had the same issue with my MacBook M1. I tried deleting and running flutter pub cache repair But It didn't work for me.
Then I ran the command softwareupdate --install-rosetta and accepted the software licences & agreement (After installing XCode). Now the command flutter works fine. :)
Tried all of the above without success. The search order in the PATH system variable turned out to be the problem:
it was:
G:\My Drive\Compilers\flutter\bin;
G:\My Drive\Compilers\flutter\bin\flutter;
G:\My Drive\Compilers\flutter\bin\flutter.bat;
G:\My Drive\Compilers\flutter\bin\dart.exe;
G:\My Drive\Compilers\flutter\bin\dart;
G:\My Drive\Compilers\flutter\bin\dart.bat;
changed it to:
G:\My Drive\Compilers\flutter\bin\flutter
G:\My Drive\Compilers\flutter\bin\flutter.bat
G:\My Drive\Compilers\flutter\bin\dart
G:\My Drive\Compilers\flutter\bin\dart.bat
that fixed it
Mac auto iCloud upload might be causing the error
If you are using Mac and if your Desktop files are being uploaded to iCloud automatically, sometimes iCloud uploads the "bin" file or the "cache" file inside the flutter file. I've just downloaded the file onto desktop (right click the file -> "Download Now") and it downloaded the file, it ran as usual. (Automatic upload can be turned off from system preferences if youn are getting this error frequently like I was).
For my case, i was using ubuntu, and after reading the above comments, i have come to a resolution that the above error comes as a result of permissions being blocked, accessing cmd with admin access levels solves the problem, e.g on linux run sudo flutter doctor and the problem will be solved.
This error occured to me when i tried upgrading my flutter so it needed admin rights to be upgraded nothing much