How to resolve Flutter unsatisfied link error? - flutter

In Firebase crashlytics, I am getting the following information about the crash.
Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myawesomeapp/com.example.myawesomeapp.MainActivity}: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/base.apk", zip file "/data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/split_config.en.apk", zip file "/data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/split_config.es.apk", zip file "/data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/split_config.x86.apk", zip file "/data/app/com.example.myawesomeapp-zqi6k7PQCL8VlHwCIoANUA==/split_config.xxhdpi.apk"],nativeLibraryDirectories=[/data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/lib/x86, /data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/base.apk!/lib/x86, /data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/split_config.en.apk!/lib/x86, /data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/split_config.es.apk!/lib/x86, /data/app/com.example.myawesomeapp-dghasjbcdcjdfhcn==/split_config.x86.apk!/lib/x86, /data/app/com.example.myawesomeapp-zqi6k7PQCL8VlHwCIoANUA==/split_config.xxhdpi.apk!/lib/x86, /system/lib, /system/vendor/lib]]] couldn't find "libflutter.so"
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Related

Failing to run Flutter app on a different machine

I have been working on a flutter project for a while now, but I had to change the PC I am using for some reasons. the thing is that every time I try to run the app I get bunch of errors then the app crashes and the connection get lost. I tried to run the app from the old PC again and It worked fine.
This is the stack of errors I get before the crash:
E/LB (21021): fail to open file: No such file or directory
I/m.example.test(21021): ProcessProfilingInfo new_methods=92 is saved saved_to_disk=1 resolve_classes_delay=8000
D/DecorView: getWindowModeFromSystem windowmode is 1
I/flutter (21021): True
E/AndroidRuntime(21021): FATAL EXCEPTION: flutter-worker-1
E/AndroidRuntime(21021): Process: com.example.test1, PID: 21021
E/AndroidRuntime(21021): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/tekartik/sqflite/LogLevel;
E/AndroidRuntime(21021): at com.tekartik.sqflite.SqflitePlugin.onOpenDatabaseCall(SqflitePlugin.java:733)
E/AndroidRuntime(21021): at com.tekartik.sqflite.SqflitePlugin.onMethodCall(SqflitePlugin.java:983)
E/AndroidRuntime(21021): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:261)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:321)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger$SerialTaskQueue.flush(DartMessenger.java:173)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger$SerialTaskQueue.lambda$dispatch$0$io-flutter-embedding-engine-dart-DartMessenger$SerialTaskQueue(DartMessenger.java:163)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger$SerialTaskQueue$$ExternalSyntheticLambda0.run(Unknown Source:2)
E/AndroidRuntime(21021): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(21021): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(21021): at java.lang.Thread.run(Thread.java:923)
E/AndroidRuntime(21021): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tekartik.sqflite.LogLevel" on path: DexPathList[[zip file "/data/app/~~Jf92ML0d6XYgNbFc-Me8kg==/com.example.test1-i0I0QGqwfxD8m-Juiw5BfQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~Jf92ML0d6XYgNbFc-Me8kg==/com.example.test1-i0I0QGqwfxD8m-Juiw5BfQ==/lib/arm64, /data/app/~~Jf92ML0d6XYgNbFc-Me8kg==/com.example.test1-i0I0QGqwfxD8m-Juiw5BfQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
E/AndroidRuntime(21021): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
E/AndroidRuntime(21021): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(21021): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(21021): ... 12 more
I/Process (21021): Sending signal. PID: 21021 SIG: 9
Lost connection to device.
Anyone have any idea of what is going on here?
Thanks in advance.
Are you sure you have the same version of flutter as the computer you are using? You can check this thread

How to resolve java.lang.NoClassDefFoundError errors in flutter?

When I run the app from flutter to the Android simulator, the following error is returned, and it does not run, I don't know what the problem is, please advise on the error.
Launching lib/main.dart on Android SDK built for arm64 in debug mode...
lib/main.dart:1
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:57149/NUW2Tq4P_Hg=/ws
E/AndroidRuntime( 8510): FATAL EXCEPTION: main
E/AndroidRuntime( 8510): Process: com.example.qnsdk_example, PID: 8510
E/AndroidRuntime( 8510): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/localbroadcastmanager/content/LocalBroadcastManager;
E/AndroidRuntime( 8510): at com.yolanda.health.qnblesdk.out.QNBleApi.setBleDeviceDiscoveryListener(QNBleApi.java:787)
E/AndroidRuntime( 8510): at com.example.qnsdk.QNSdkPlugin.setBleDeviceDiscoveryListener(QNSdkPlugin.kt:146)
E/AndroidRuntime( 8510): at com.example.qnsdk.QNSdkPlugin.onMethodCall(QNSdkPlugin.kt:82)
E/AndroidRuntime( 8510): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/AndroidRuntime( 8510): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
E/AndroidRuntime( 8510): at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
E/AndroidRuntime( 8510): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$R4HPk6oFVb-i-YR_PN9YE6kqx1I.run(Unknown Source:12)
E/AndroidRuntime( 8510): at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime( 8510): at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime( 8510): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 8510): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 8510): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8510): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 8510): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/AndroidRuntime( 8510): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.localbroadcastmanager.content.LocalBroadcastManager" on path: DexPathList[[zip file "/data/app/com.example.qnsdk_example-cDdo9nfJTxqNGC_B2Gxa2g==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.qnsdk_example-cDdo9nfJTxqNGC_B2Gxa2g==/lib/arm64, /data/app/com.example.qnsdk_example-cDdo9nfJTxqNGC_B2Gxa2g==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]
E/AndroidRuntime( 8510): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
E/AndroidRuntime( 8510): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime( 8510): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime( 8510): ... 14 more
I/flutter ( 8510): initSDK 1108
I/Process ( 8510): Sending signal. PID: 8510 SIG: 9
Lost connection to device.
Exited (sigterm)
and in the sdk manager
android sdk command-line tools (latest)
I followed it because I had to check it, but the error does not go away and continues.
Try this:
Open Tools > SDK Manager
choose Appearance & Behavior > System Settings > Android SDK
Select SDK Tools
Check Android SDK Command-line tools and click ‘apply’.

Regular TensorFlow ops are not supported by this interpreter. Make sure you apply/link the Flex delegate before inference

I have a problem when running a tflite model in my image classification app project( flutter ).
I have converted my CNN model to a tflite model via the code below:
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model('/content/drive/MyDrive/CNN_Model/10.07.CNNmodel.100.92')
# converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_LATENCY]
converter.target_spec.supported_ops = [
tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)
I tested the output of the tflite model and believe that it was converted successful. But when I added to my dart file in my project by the code:
Future loadModel() async {
await Tflite.loadModel(
model: 'assets/tflite/converted_model.tflite',
labels: 'assets/tflite/labels.txt',
);
}
After I ran the main.dart, took a picture to test, I got these errors:
E/AndroidRuntime( 6189): FATAL EXCEPTION: AsyncTask #1
E/AndroidRuntime( 6189): Process: com.hajaj_projects.cat_vs_dog, PID: 6189
E/AndroidRuntime( 6189): java.lang.RuntimeException: An error occurred while executing doInBackground()
E/AndroidRuntime( 6189): at android.os.AsyncTask$4.done(AsyncTask.java:415)
E/AndroidRuntime( 6189): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
E/AndroidRuntime( 6189): at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
E/AndroidRuntime( 6189): at java.util.concurrent.FutureTask.run(FutureTask.java:271)
E/AndroidRuntime( 6189): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
E/AndroidRuntime( 6189): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime( 6189): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime( 6189): at java.lang.Thread.run(Thread.java:923)
E/AndroidRuntime( 6189): Caused by: java.lang.IllegalArgumentException: Internal error: Failed to run on the given Interpreter: Regular TensorFlow ops are not supported by this interpreter. Make sure you apply/link the Flex delegate before inference.
E/AndroidRuntime( 6189): Node number 21 (FlexAddV2) failed to prepare.
E/AndroidRuntime( 6189):
E/AndroidRuntime( 6189): at org.tensorflow.lite.NativeInterpreterWrapper.run(Native Method)
E/AndroidRuntime( 6189): at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:204)
E/AndroidRuntime( 6189): at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:374)
E/AndroidRuntime( 6189): at org.tensorflow.lite.Interpreter.run(Interpreter.java:332)
E/AndroidRuntime( 6189): at sq.flutter.tflite.TflitePlugin$RunModelOnImage.runTflite(TflitePlugin.java:504)
E/AndroidRuntime( 6189): at sq.flutter.tflite.TflitePlugin$TfliteTask.doInBackground(TflitePlugin.java:471)
E/AndroidRuntime( 6189): at sq.flutter.tflite.TflitePlugin$TfliteTask.doInBackground(TflitePlugin.java:445)
E/AndroidRuntime( 6189): at android.os.AsyncTask$3.call(AsyncTask.java:394)
E/AndroidRuntime( 6189): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/AndroidRuntime( 6189): ... 4 more
I/Process ( 6189): Sending signal. PID: 6189 SIG: 9
Lost connection to device.
When I removed the Normalization layer in my CNN model then converted it again, the app runs smoothly. But removing Normalization model decreased lots of my model accuracy.
I'm new to flutter. By any chance, has anybody encountered and resolved this before? Thanks for spending time.
dependencies {
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly-SNAPSHOT'
// This dependency adds the necessary TF op support.
implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:0.0.0-nightly-SNAPSHOT'
}
The converted model contains the Select TF ops. This means the model requires the Select TF op dependency.
If the above dependency is too big footprint, please consider creating a custom AAR through the selective build https://www.tensorflow.org/lite/guide/reduce_binary_size
See also https://www.tensorflow.org/lite/guide/ops_select.

Porting Android App to BB10 OS (BlackBerry)

I am trying to port a native Android app to BB10 OS (BlackBerry). I was able to install the app but when I launch it, I see this error:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to create application com.example.MyApplication: java.lang.SecurityException: Failed to open /dev/urandom for writing
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4454)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5116)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.SecurityException: Failed to open /dev/urandom for writing
at o.dD$if.Ë‹(:279)
at o.dD$if.engineSetSeed(:215)
at java.security.SecureRandom.setSeed(SecureRandom.java:243)
at java.security.SecureRandom.setSeed(SecureRandom.java:258)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at o.ff$Õ™.<clinit>(Unknown Source)
at o.dA.ËŠ(:285)
at o.dA.<init>(:99)
at o.dA.ËŠ(:151)
at com.example.MyApplication.ͺ(:182)
at com.example.MyApplication.onCreate(:66)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4451)
... 10 more
Caused by: java.io.FileNotFoundException: /dev/urandom: open failed: EACCES (Permission denied)
at libcore.io.IoBridge.open(IoBridge.java:409)
at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
at o.dD$if.Ë‹(:277)
... 23 more
Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:393)
... 26 more
W/ActivityManager(6766745): Force finishing activity com.example.android.agent/com.example.agent.activities.LaunchActivity
E/OrientationUtil(6766745): Unable to read sensor data. errno 11
D/dalvikvm(20689057): GC_CONCURRENT freed 307K, 5% free 10097K/10576K, paused 1ms+1ms, total 48ms
Any insights into addressing this issue is highly appreciated.

Android: Published App crashes with ClassNotFoundException

I have just published my first app today but for some reason when I use the published version I keep getting a ClassNotFoundException error when it starts up. It works fine when I test it in debug mode on my phone so I'm not sure whats causing this.
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.androidProjects.personal/com.androidProjects.personal.GAAClubFinderActivity}: java.lang.ClassNotFoundException: com.androidProjects.personal.GAAClubFinderActivity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2141)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2260)
at android.app.ActivityThread.access$600(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1277)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:5045)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.androidProjects.personal.GAAClubFinderActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1039)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2132)
... 11 more
Any Ideas?