Remove conflicting slf4j packages from External aar Android - android

I have integrated an SDK .aar which contains packages for slf4j library and already have one library which is using different artifacts.Therefore app code is calling to library and library not considering it artefact packages and call it from SDK due to that app is crashing. crash logs are as follows.
java.lang.ExceptionInInitializerError
at template_engine.TemplateEngine.<init>(TemplateEngine.kt:84)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8107)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: java.lang.NullPointerException: throw with null exception
** at org.slf4j.impl.Log4jLoggerFactory.getLogger(Unknown Source:1) ** // it is calling from SDK
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:358)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
at com.github.jknack.handlebars.Handlebars.<clinit>(Handlebars.java:251)
at template_engine.TemplateEngine.<init>(TemplateEngine.kt:84)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 
at android.os.Handler.handleCallback(Handler.java:883) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at android.os.Looper.loop(Looper.java:237) 
at android.app.ActivityThread.main(ActivityThread.java:8107) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100) 
Please Help me with these i have already tried exclude it from Gradle SDK .aar but it is not working. Thanks in advance.

Related

PackageManager$NameNotFoundException for rxAndroidBle

For version 1.12.1, I am getting a runtime exception after upgrading to this version from 1.10.5
2021-07-16 15:30:16.588 22665-22665/co.(appname).staging E/AndroidRuntime: FATAL EXCEPTION: main
Process: co.(appname).staging:svc, PID: 22665
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/jakewharton/rxrelay2/BehaviorRelay;
at com.polidea.rxandroidble2.internal.DeviceModule.provideConnectionStateRelay(DeviceModule.java:57)
at com.polidea.rxandroidble2.internal.DeviceModule_ProvideConnectionStateRelayFactory.get(DeviceModule_ProvideConnectionStateRelayFactory.java:17)
at com.polidea.rxandroidble2.internal.DeviceModule_ProvideConnectionStateRelayFactory.get(DeviceModule_ProvideConnectionStateRelayFactory.java:9)
at bleshadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at com.polidea.rxandroidble2.internal.RxBleDeviceImpl_Factory.get(RxBleDeviceImpl_Factory.java:31)
at com.polidea.rxandroidble2.internal.RxBleDeviceImpl_Factory.get(RxBleDeviceImpl_Factory.java:11)
at bleshadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at com.polidea.rxandroidble2.DaggerClientComponent$DeviceComponentImpl.provideDevice(DaggerClientComponent.java:509)
at com.polidea.rxandroidble2.internal.RxBleDeviceProvider.getBleDevice(RxBleDeviceProvider.java:43)
at com.polidea.rxandroidble2.internal.scan.InternalToExternalScanResultConverter.apply(InternalToExternalScanResultConverter.java:26)
at com.polidea.rxandroidble2.internal.scan.InternalToExternalScanResultConverter.apply(InternalToExternalScanResultConverter.java:13)
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:57)
at io.reactivex.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onNext(ObservableUnsubscribeOn.java:60)
at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onNext(ObservableCreate.java:66)
at com.polidea.rxandroidble2.internal.serialization.FIFORunnableEntry$1$1.onNext(FIFORunnableEntry.java:68)
at io.reactivex.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onNext(ObservableUnsubscribeOn.java:60)
at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onNext(ObservableCreate.java:66)
at com.polidea.rxandroidble2.internal.operations.ScanOperationApi21$1.onScanResult(ScanOperationApi21.java:83)
at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper$1.run(BluetoothLeScanner.java:492)
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:7664)
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.ClassNotFoundException: Didn't find class "com.jakewharton.rxrelay2.BehaviorRelay" on path: DexPathList[[zip file "/data/app/~~azBMNu86abFT1X-EHOpB2A==/co.(appname).staging-eYQb5VbY1nmgyq2oa0oeWA==/base.apk"],nativeLibraryDirectories=[/data/app/~~azBMNu86abFT1X-EHOpB2A==/co.(appname).staging-eYQb5VbY1nmgyq2oa0oeWA==/lib/arm64, /data/app/~~azBMNu86abFT1X-EHOpB2A==/co.(appname).staging-eYQb5VbY1nmgyq2oa0oeWA==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.polidea.rxandroidble2.internal.DeviceModule.provideConnectionStateRelay(DeviceModule.java:57) 
at com.polidea.rxandroidble2.internal.DeviceModule_ProvideConnectionStateRelayFactory.get(DeviceModule_ProvideConnectionStateRelayFactory.java:17) 
at com.polidea.rxandroidble2.internal.DeviceModule_ProvideConnectionStateRelayFactory.get(DeviceModule_ProvideConnectionStateRelayFactory.java:9) 
at bleshadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47) 
at com.polidea.rxandroidble2.internal.RxBleDeviceImpl_Factory.get(RxBleDeviceImpl_Factory.java:31) 
at com.polidea.rxandroidble2.internal.RxBleDeviceImpl_Factory.get(RxBleDeviceImpl_Factory.java:11) 
at bleshadow.dagger.internal.DoubleCheck.get(DoubleCheck.java:47) 
at com.polidea.rxandroidble2.DaggerClientComponent$DeviceComponentImpl.provideDevice(DaggerClientComponent.java:509) 
at com.polidea.rxandroidble2.internal.RxBleDeviceProvider.getBleDevice(RxBleDeviceProvider.java:43) 
at com.polidea.rxandroidble2.internal.scan.InternalToExternalScanResultConverter.apply(InternalToExternalScanResultConverter.java:26) 
at com.polidea.rxandroidble2.internal.scan.InternalToExternalScanResultConverter.apply(InternalToExternalScanResultConverter.java:13) 
at io.reactivex.internal.operators.observable.ObservableMap$MapObserver.onNext(ObservableMap.java:57) 
at io.reactivex.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onNext(ObservableUnsubscribeOn.java:60) 
at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onNext(ObservableCreate.java:66) 
at com.polidea.rxandroidble2.internal.serialization.FIFORunnableEntry$1$1.onNext(FIFORunnableEntry.java:68) 
at io.reactivex.internal.operators.observable.ObservableUnsubscribeOn$UnsubscribeObserver.onNext(ObservableUnsubscribeOn.java:60) 
at io.reactivex.internal.operators.observable.ObservableCreate$CreateEmitter.onNext(ObservableCreate.java:66) 
at com.polidea.rxandroidble2.internal.operations.ScanOperationApi21$1.onScanResult(ScanOperationApi21.java:83) 
at android.bluetooth.le.BluetoothLeScanner$BleScanCallbackWrapper$1.run(BluetoothLeScanner.java:492) 
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:7664) 
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 catch? I have forked the repo, made a couple very small changes (like small changes to timeouts for example), and created a build with Jitpack. I checked their Jitpack build log (https://jitpack.io/com/github/polidea/RxAndroidBle/release-1.12.1-rxjava2/build.log) against my own, and they are almost identical. I see the missing errors, I have the exact same ones. The difference is that if I use the official polidea rxAndroidBle gradle thing (which I believe is pulled from Jitpack), I do not get the same runtime issue.
I have been looking for hours and feel like I am at a dead-end. I wanted to create an issue against the repo, but I am not confident that it is their issue. Something specific with what I have done with the build, but I do not know where the difference could be.
I was able to solve the issue by adding again the missing libraries that are not resolved when publishing a version with JitPack.
android: 'io.reactivex.rxjava2:rxandroid:2.1.0',
java : 'io.reactivex.rxjava2:rxjava:2.2.2',
relay : 'com.jakewharton.rxrelay2:rxrelay:2.1.0'

Android Chromium Build fail with NDK Library Load

Whenever we trying to build Chromium in android studio that time its fail to load NDK library.
Error logs are here :
org.chromium.base.library_loader.ProcessInitException: errorCode=4
at org.chromium.chrome.browser.init.AsyncInitializationActivity.onStartupFailure(AsyncInitializationActivity.java:286)
at org.chromium.chrome.browser.init.NativeInitializationController$1.onFailure(NativeInitializationController.java:101)
at org.chromium.chrome.browser.init.AsyncInitTaskRunner.tasksPossiblyComplete(AsyncInitTaskRunner.java:182)
at org.chromium.chrome.browser.init.AsyncInitTaskRunner.lambda$null$0$AsyncInitTaskRunner(AsyncInitTaskRunner.java:127)
at org.chromium.chrome.browser.init.-$$Lambda$AsyncInitTaskRunner$cJc0Kjib2rp_haGN4uefBvQ1s58.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: org.chromium.base.library_loader.ProcessInitException: errorCode=2
at org.chromium.base.library_loader.LibraryLoader.loadMainDexAlreadyLocked(LibraryLoader.java:662)
at org.chromium.base.library_loader.LibraryLoader.ensureMainDexInitialized(LibraryLoader.java:456)
at org.chromium.base.library_loader.LibraryLoader.ensureInitialized(LibraryLoader.java:440)
at org.chromium.chrome.browser.init.AsyncInitTaskRunner.loadNativeLibrary(AsyncInitTaskRunner.java:138)
at org.chromium.chrome.browser.init.AsyncInitTaskRunner.lambda$startBackgroundTasks$1$AsyncInitTaskRunner(AsyncInitTaskRunner.java:126)
at org.chromium.chrome.browser.init.-$$Lambda$AsyncInitTaskRunner$xIQXLdsNGYGpypXLZkBvhfVEoSo.run(Unknown Source:2)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.chromium.chrome-3FZb2O0sMrWWCQ2kNEh8Og==/base.apk"],nativeLibraryDirectories=[/data/app/org.chromium.chrome-3FZb2O0sMrWWCQ2kNEh8Og==/lib/arm, /data/app/org.chromium.chrome-3FZb2O0sMrWWCQ2kNEh8Og==/base.apk!/lib/armeabi-v7a, /system/lib]]] couldn't find "libc++_chrome.cr.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 org.chromium.base.library_loader.LibraryLoader.loadWithSystemLinkerAlreadyLocked(LibraryLoader.java:617)
at org.chromium.base.library_loader.LibraryLoader.loadMainDexAlreadyLocked(LibraryLoader.java:653)
Please review this and share solution if you have any thank you.

Android Singed APK crashed

I am facing issue with the Signed APK, debug apk works perfectly, When I generate signed apk and run it show error.
below is error log
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.woodenstreet, PID: 25818
java.lang.NoSuchMethodError: No virtual method x(Ljava/lang/String;I)I in class Lorg/json/JSONObject; or its super classes (declaration of 'org.json.JSONObject' appears in /apex/com.android.runtime/javalib/core-libart.jar)
at com.google.firebase.crashlytics.internal.settings.DefaultSettingsJsonTransform.d(SourceFile:1)
at com.google.firebase.crashlytics.internal.settings.DefaultSettingsJsonTransform.e(SourceFile:2)
at com.google.firebase.crashlytics.internal.settings.SettingsController.(SourceFile:11)
at com.google.firebase.crashlytics.internal.settings.SettingsController.l(SourceFile:14)
at com.google.firebase.crashlytics.internal.Onboarding.l(SourceFile:4)
at com.google.firebase.crashlytics.FirebaseCrashlytics.a(SourceFile:26)
at com.google.firebase.crashlytics.CrashlyticsRegistrar.b(SourceFile:5)
at com.google.firebase.crashlytics.CrashlyticsRegistrar.a(Unknown Source:0)
at com.google.firebase.crashlytics.CrashlyticsRegistrar$$Lambda$1.a(Unknown Source:2)
at com.google.firebase.components.ComponentRuntime.f(SourceFile:1)
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4)
at com.google.firebase.components.Lazy.get(SourceFile:6)
at com.google.firebase.components.ComponentRuntime.e(SourceFile:5)
at com.google.firebase.FirebaseApp.n(SourceFile:7)
at com.google.firebase.FirebaseApp.q(SourceFile:13)
at com.google.firebase.FirebaseApp.p(SourceFile:1)
at com.google.firebase.FirebaseApp.o(SourceFile:7)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(SourceFile:1)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2092)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2066)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(SourceFile:2)
at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)
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(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Here build.gradle app level file
Build file
I am not able to figure out the error please help me.
Thanks
Your release configuration in build.gradle is not correct for your libraries. I think it have to do with json, and proguard obfuscates some methods of it.
try this https://stackoverflow.com/a/61481954/10117882

React Native app crashing at startup on Android: Didn't find class "com.facebook.react.devsupport.DevSupportManagerImpl"

I am using React Native v 0.62.2 and I am trying to get my project running on Android as well. Up until now, I had focussed development on iOS and therefore did never run the Android app. Now I wanted to run the android app but the app crashes on startup right after the splash screen was shown with the following stacktrace:
java.lang.RuntimeException: Unable to create application com.myapp.MainApplication: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6612)
at android.app.ActivityThread.access$1300(ActivityThread.java:233)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7523)
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:941)
Caused by: java.lang.RuntimeException: Requested enabled DevSupportManager, but DevSupportManagerImpl class was not found or could not be created
at com.facebook.react.devsupport.a.a(:90)
at com.facebook.react.q.<init>(:238)
at com.facebook.react.r.b(:281)
at com.facebook.react.t.a(:87)
at com.facebook.react.t.h(:39)
at com.myapp.MainApplication.onCreate(:48)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6607)
at android.app.ActivityThread.access$1300(ActivityThread.java:233) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7523) 
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:941) 
Caused by: java.lang.ClassNotFoundException: com.facebook.react.devsupport.DevSupportManagerImpl
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at java.lang.Class.forName(Class.java:379)
at com.facebook.react.devsupport.a.a(:68)
at com.facebook.react.q.<init>(:238) 
at com.facebook.react.r.b(:281) 
at com.facebook.react.t.a(:87) 
at com.facebook.react.t.h(:39) 
at com.myapp.MainApplication.onCreate(:48) 
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6607) 
at android.app.ActivityThread.access$1300(ActivityThread.java:233) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7523) 
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:941) 
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.react.devsupport.DevSupportManagerImpl" on path: DexPathList[[zip file "/data/app/~~WocKG3K03wTNVqsJq3z5Xg==/com.myapp-F972FEHz8FF4xF-BTG7qlg==/base.apk"],nativeLibraryDirectories=[/data/app/~~WocKG3K03wTNVqsJq3z5Xg==/com.myapp-F972FEHz8FF4xF-BTG7qlg==/lib/x86, /data/app/~~WocKG3K03wTNVqsJq3z5Xg==/com.myapp-F972FEHz8FF4xF-BTG7qlg==/base.apk!/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:454) 
at java.lang.Class.forName(Class.java:379) 
at com.facebook.react.devsupport.a.a(:68) 
at com.facebook.react.q.<init>(:238) 
at com.facebook.react.r.b(:281) 
at com.facebook.react.t.a(:87) 
at com.facebook.react.t.h(:39) 
at com.myapp.MainApplication.onCreate(:48) 
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6607) 
at android.app.ActivityThread.access$1300(ActivityThread.java:233) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1896) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:223) 
at android.app.ActivityThread.main(ActivityThread.java:7523) 
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:941) 
I searched the web for solutions or at least hints but did unfortunately not find any solution or even any idea of what could be done to fix this issue.
Does anyone have any idea? Also please let me know if you need any further information in order to be able to answer the question.
Thanks a lot!
For all who are struggling with this issue as well - after a long period of research plus try and error, I got it finally fixed.
It seems that this issue actually is correlated to OK HTTP. The steps that made me get it running were the following:
Enable MultiDex but also keep attention on going for the AndroidX solution (as I use the latest version of React Native which already leverages AndroidX) as stated in the following answer:
https://stackoverflow.com/a/56875424/9055450
Follow the instructions given in the following comment adding ProGuard files: https://github.com/facebook/react-native/issues/9043#issuecomment-298832659

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.

Categories

Resources