flutter app not launching in from release apk - android

flutter app works just fine in android debug, ios debug and ios release. but with android release (flutter build apk) it just does not launch.
What I've tried:
lowering the gradle version from 4.1.3 to 3.6.2 as suggested in here.
running with no-shrink flag (flutter build apk --no-shrink).
setting shrinkResources and minifyEnabled to false in android/app/build.gradle
HERE IS A VIDEO THAT SHOWS THE ERROR CLEARLY
this is my flutter doctor -v output:
[√] Flutter (Channel stable, 2.0.5, on Microsoft Windows [Version 10.0.19041.928], locale
en-US)
• Flutter version 2.0.5 at C:\Users\adnan\flutter
• Framework revision adc687823a (3 days ago), 2021-04-16 09:40:20 -0700
• Engine revision b09f014e96
• Dart version 2.12.3
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\adnan\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.55.2)
• VS Code at C:\Users\adnan\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.21.0
[√] Connected device (3 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30)
(emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.128
• Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.57
• No issues found!
edit: here is the error log from the android studio Logcat:
2021-04-20 09:58:24.300 6866-6866/? E/FlutterLoader: Flutter initialization failed.
java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
at java.util.concurrent.FutureTask.report(FutureTask.java:123)
at java.util.concurrent.FutureTask.get(FutureTask.java:193)
at io.flutter.embedding.engine.g.c.c(Unknown Source:23)
at io.flutter.embedding.engine.a.<init>(Unknown Source:202)
at io.flutter.embedding.engine.a.<init>(Unknown Source:16)
at io.flutter.embedding.android.f.B(Unknown Source:106)
at io.flutter.embedding.android.f.k(Unknown Source:7)
at io.flutter.embedding.android.e.onCreate(Unknown Source:13)
at com.myExampleApp.MainActivity.onCreate(Unknown Source:0)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at io.flutter.embedding.engine.FlutterJNI.loadLibrary(Unknown Source:13)
at io.flutter.embedding.engine.g.c$a.a(Unknown Source:14)
at io.flutter.embedding.engine.g.c$a.call(Unknown Source:0)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
2021-04-20 09:58:24.300 6866-6866/? D/AndroidRuntime: Shutting down VM
--------- beginning of crash
2021-04-20 09:58:24.301 6866-6866/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myExampleApp, PID: 6866
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myExampleApp/com.myExampleApp.MainActivity}: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
at io.flutter.embedding.engine.g.c.c(Unknown Source:367)
at io.flutter.embedding.engine.a.<init>(Unknown Source:202)
at io.flutter.embedding.engine.a.<init>(Unknown Source:16)
at io.flutter.embedding.android.f.B(Unknown Source:106)
at io.flutter.embedding.android.f.k(Unknown Source:7)
at io.flutter.embedding.android.e.onCreate(Unknown Source:13)
at com.myExampleApp.MainActivity.onCreate(Unknown Source:0)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7656) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
Caused by: java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
at java.util.concurrent.FutureTask.report(FutureTask.java:123)
at java.util.concurrent.FutureTask.get(FutureTask.java:193)
at io.flutter.embedding.engine.g.c.c(Unknown Source:23)
at io.flutter.embedding.engine.a.<init>(Unknown Source:202) 
at io.flutter.embedding.engine.a.<init>(Unknown Source:16) 
at io.flutter.embedding.android.f.B(Unknown Source:106) 
at io.flutter.embedding.android.f.k(Unknown Source:7) 
at io.flutter.embedding.android.e.onCreate(Unknown Source:13) 
at com.myExampleApp.MainActivity.onCreate(Unknown Source:0) 
at android.app.Activity.performCreate(Activity.java:8000) 
at android.app.Activity.performCreate(Activity.java:7984) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7656) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libflutter.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at io.flutter.embedding.engine.FlutterJNI.loadLibrary(Unknown Source:13)
at io.flutter.embedding.engine.g.c$a.a(Unknown Source:14)
at io.flutter.embedding.engine.g.c$a.call(Unknown Source:0)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
2021-04-20 09:58:24.308 519-5643/? W/ActivityTaskManager: Force finishing activity com.myExampleApp/.MainActivity
2021-04-20 09:58:24.309 306-306/? W/EmuHWC2: validate: layer 37 CompositionType 1, fallback
(maybe duplicate of this)

its a general flutter sdk and android architecture support issue as at now, waiting for a permanent fix....
but This abifilters solution solved the issue on emulator blue stacks emulating an LG phone for me..
Add the ndk code in the defaultConfig tag inside your build.gradle android file of your project
**
android {
//...
defaultConfig {
ndk {
// Filter for architectures supported by Flutter.
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
}
}
}
**
Dont know if has drawbacks on other phones, but i will be updating this thread as we rollout and see which phones our customers who get same issues again are getting it on
Edit, Also Add lines below to the end of settings.gradle: file to filter more.. This code will generate file libflutter.so on folders x86_64, arm64-v8a and armeabi-v7a. And for devices x86, then emulate arm which are the devices with the problems..
gradle.beforeProject({ project->
if (project.hasProperty("target-platform") &&
!project.getProperty("target-platform").split(",").contains("android-arm")) {
project.setProperty("target-platform", "android-arm,android-arm64")
}
})

Related

Capacitor: Unable to load capacitor.config.json

Creating an Ionic 5 app with Capacitor, I'm running into this problem where it seems that capacitor.config.json is not being loaded.
This problem came after I've installed #codetrix-studio/capacitor-google-auth, before the project was running on android fine.
{
"appId": "com.luyou.clauncher",
"appName": "c-launchpad",
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "www",
"plugins": {
"SplashScreen": {
"launchShowDuration": 0
},
"GoogleAuth": {
"scopes": [
"profile",
"email"
],
"serverClientId": "xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com", // On my project I'm using the real server client id
"forceCodeForRefreshToken": true
}
}
}
On the android studio the build goes okay but when you try to open the app, it does crash with the following:
D/Capacitor: Starting BridgeActivity
E/Capacitor: Unable to load capacitor.config.json. Run npx cap copy first
java.io.FileNotFoundException: capacitor.config.json
at android.content.res.AssetManager.nativeOpenAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:874)
at android.content.res.AssetManager.open(AssetManager.java:851)
at com.getcapacitor.FileUtils.readFile(FileUtils.java:148)
at com.getcapacitor.CapConfig.loadConfig(CapConfig.java:121)
at com.getcapacitor.CapConfig.loadDefault(CapConfig.java:85)
at com.getcapacitor.Bridge.<init>(Bridge.java:152)
at com.getcapacitor.Bridge$Builder.create(Bridge.java:1160)
at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:73)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:54)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:37)
at com.luyou.clauncher.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
D/Capacitor: Registering plugin: WebView
D/Capacitor: Registering plugin: AdMob
D/Capacitor: Registering plugin: GoogleAuth
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.luyou.clauncher, PID: 11477
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.luyou.clauncher/com.luyou.clauncher.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference
at com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.load(GoogleAuth.java:47)
at com.getcapacitor.PluginHandle.load(PluginHandle.java:95)
at com.getcapacitor.PluginHandle.<init>(PluginHandle.java:59)
at com.getcapacitor.Bridge.registerPlugin(Bridge.java:464)
at com.getcapacitor.Bridge.registerAllPlugins(Bridge.java:419)
at com.getcapacitor.Bridge.<init>(Bridge.java:164)
at com.getcapacitor.Bridge$Builder.create(Bridge.java:1160)
at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:73)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:54)
at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:37)
at com.luyou.clauncher.MainActivity.onCreate(MainActivity.java:19)
at android.app.Activity.performCreate(Activity.java:8000)
at android.app.Activity.performCreate(Activity.java:7984)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7656) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
I/Process: Sending signal. PID: 11477 SIG: 9
capacitor.config.json is already on the root path of the project and doing npx cap copy or npx cap sync doesn't solve this problem, but actually is copying the www files. For some reason, the capacitor config simply is just not being copied.
Seems like Capacitor alpha versions are broken, so gonig back to Capacitor 2.4.7 fixes the problem. The capacitor.config.json is loading correctly and the native plugins are loading fine.
awesome, thanks #Adrian Legaspi.
Downgrading to capacitor 2.4.7 solved it for me.
This is what my package.json looks like:
"dependencies": {
...
"#capacitor/android": "^2.4.2",
"#capacitor/core": "2.4.7",
..
},
"devDependencies": {
...
"#capacitor/cli": "2.4.2",
...
}

DeepSpeechDemo App works with Gradle cli but crashes when built with Android Studio

The android-mic-streaming demo works off-the-shelf using ./gradlew installDebug, but when the play button in Android Studio is used to compile and install the exact same project it crashes with the following after tapping record:
2020-08-19 00:44:24.862 12872-12872/org.deepspeechdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.deepspeechdemo, PID: 12872
java.lang.IllegalStateException: Could not execute method for android:onClick
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:390)
at android.view.View.performClick(View.java:7448)
at android.view.View.performClickInternal(View.java:7425)
at android.view.View.access$3600(View.java:810)
at android.view.View$PerformClick.run(View.java:28296)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385)
at android.view.View.performClick(View.java:7448) 
at android.view.View.performClickInternal(View.java:7425) 
at android.view.View.access$3600(View.java:810) 
at android.view.View$PerformClick.run(View.java:28296) 
at android.os.Handler.handleCallback(Handler.java:938) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7656) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libdeepspeech-jni.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at org.mozilla.deepspeech.libdeepspeech.DeepSpeechModel.<clinit>(DeepSpeechModel.java:9)
at org.deepspeechdemo.MainActivity.createModel(MainActivity.kt:90)
at org.deepspeechdemo.MainActivity.onRecordClick(MainActivity.kt:120)
at java.lang.reflect.Method.invoke(Native Method) 
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:385) 
at android.view.View.performClick(View.java:7448) 
at android.view.View.performClickInternal(View.java:7425) 
at android.view.View.access$3600(View.java:810) 
at android.view.View$PerformClick.run(View.java:28296) 
at android.os.Handler.handleCallback(Handler.java:938) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7656) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) 
The issue seems to be related to libdeepspeech-jni.so not being included when Android Studio is used. I am completely new to Android development (I'm building a Mozilla-STT React Native module and only supporting iOS is useless) so this is especially confusing.
Thanks!
EDIT:
Hours of random trial and error later: Changing this option from "Default APK" to "APK from app bundle" in Android Studio made the demo start working
However, doing the same on my example app for the React Native module (which has a dependency android project which finally depends on the actual libdeepspeech) didn't work. It started working when using x86_64, so there must be no libdeepspeech x86 binary.
Hours of random trial and error later: Changing this option from "Default APK" to "APK from app bundle" in Android Studio made the demo start working
However, doing the same on my example app for the React Native module (which has a dependency android project which finally depends on the actual libdeepspeech) didn't work. It started working when using x86_64, so there must be no libdeepspeech x86 (32 bit) binary.

Android Studio 4.1 Beta Start Failed?

I previously downloaded Android Studio 4.1 Beta 5 and it was working just fine, but when I launch it today, this error is showing:
Internal error. Please refer to https://code.google.com/p/android/issues
java.util.concurrent.CompletionException: java.lang.AssertionError: Attribute
id='AUTO_DETECTION_CACHE_ATTRIBUTE' is not unique
at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1643)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:29)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:193)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.AssertionError: Attribute id='AUTO_DETECTION_CACHE_ATTRIBUTE' is not unique
at com.intellij.openapi.vfs.newvfs.FileAttribute.<init>(FileAttribute.java:34)
at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.<init>(FileTypeManagerImpl.java:159)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at.....
-----
JRE 1.8.0_242-release-1644-b01 amd64 by JetBrains s.r.o
C:\Program Files\Android\Android Studio 4.1 Beta\jre\jre
What should I do to solve the issue?

java.lang.NullPointerException when Running Flutter App

I'm getting the below error when running an opensource Flutter app that I checked out from Github. It runs the first Activity of the screen and after about 1-second app crashes with the following error in Logcat. I'm not able to see any errors in Run console of Flutter.
Process: app.ceylon.selftrackingapp, PID: 32590
java.lang.RuntimeException: Unable to start activity ComponentInfo{app.ceylon.selftrackingapp/app.ceylon.selftrackingapp.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3448)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7811)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:116)
at com.baseflow.geolocator.GeolocatorPlugin.registerWith(GeolocatorPlugin.java:49)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:20)
at app.ceylon.selftrackingapp.MainActivity.onCreate(MainActivity.kt:32)
at android.app.Activity.performCreate(Activity.java:7955)
at android.app.Activity.performCreate(Activity.java:7944)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3423)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595) 
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:237) 
at android.app.ActivityThread.main(ActivityThread.java:7811) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076) 
2020-03-21 10:09:53.328 15534-15539/? E/nightwatch-watcher: Failed to read from logcat: Success
I'm using an actual device Galaxy S9+ for testing and here is the Flutter version that I have installed in my computer.
Flutter 1.15.17 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 2294d75bfa (2 weeks ago) • 2020-03-07 00:28:38 +0900
Engine • revision 5aff311948
Tools • Dart 2.8.0 (build 2.8.0-dev.12.0 9983424a3c)
I've also looked for the solution and I've found one here.
The core is: add " flutter_plugin_android_lifecycle: ^1.0.4" to pubspec.yaml

Android app crash after NDK upgraded from 20.1 to 21.0

I was using Android Studio to create an app using Java, Kotlin and C++.
Yesterday, I upgraded the Android NDK from version 20.1 to version 21.0, and then the android studio keeps crash if I connect to my android phone and run.
The piece of crash log in Logcat is as below.
--------- beginning of crash
2020-01-17 15:46:15.737 13606-13606/com.blinkai.Video_2020_Debugging E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.blinkai.Video_2020_Debugging, PID: 13606
java.lang.UnsatisfiedLinkError: dlopen failed: library "libomp.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1071)
at java.lang.Runtime.loadLibrary0(Runtime.java:1007)
at java.lang.System.loadLibrary(System.java:1667)
at com.blinkai.blinkai.MainActivity.<clinit>(MainActivity.kt:395)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
at android.support.v4.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:43)
at android.app.Instrumentation.newActivity(Instrumentation.java:1251)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3328)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3594)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2146)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7762)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
The code in MainActivity.kt:395 is:
// Used to load the 'native-lib' library on application startup.
init {
System.loadLibrary("native-lib")
}
Thank you very much for your help!
https://github.com/android/ndk/issues/1028
That problem mentioned in ndk repo. They suggests to use flag -static-openmp.
I put the flag in my CMakeLists.txt like:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp -static-openmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp -static-openmp")
and that's do the job.

Categories

Resources