java.lang.UnsatisfiedLinkError after enabling progaurd - android

java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/app.trell-cObHRbb2g2I_GJO51h1Usw==/lib/arm64/libNvStreamingSdkCore.so"
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.meicam.sdk.NvsStreamingContext.C(NvsStreamingContext.java:16)
at com.meishe.sdkdemo.MSApplication.init(MSApplication.java:4)
at com.meishe.sdkdemo.MSAppLoaderImpl.initMSApplication(MSAppLoader.kt:1)
at app.geochat.revamp.utils.Utils.b0(Utils.java:3)
at app.geochat.revamp.activity.HomeGenericActivity.Y0(HomeGenericActivity.java:24)
at app.geochat.revamp.activity.HomeGenericActivity.onClick(HomeGenericActivity.java:223)
at android.view.View.performClick(View.java:7254)
at android.view.View.performClickInternal(View.java:7212)
at android.view.View.access$3800(View.java:828)
at android.view.View$PerformClick.run(View.java:27889)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:227)
at android.app.ActivityThread.main(ActivityThread.java:7822)
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:1026)
java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad after enabling progaurd

You need to exclude a class from proguard. One of the lib. you're using rely on a C++ library and it's getting swallowed by proguard

Related

Remove conflicting slf4j packages from External aar 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.

Xamarin.Android release build crash on startup with r8

Edit:
Please note the following issue does not occur when using Proguard, or in debug. Only issue with R8 in release
Step to reproduce:
Create a new blank Xamarin.Android application
Without making any change, simply run in debug make sure the project compile and run
Enable r8 and multi-dex:
Create release APK
When running the release APK, it will crash on startup with error:
2021-06-04 11:35:01.818 20194-20194/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.companyname.app1, PID: 20194
java.lang.RuntimeException: Unable to instantiate application androidx.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "androidx.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/lib/x86, /data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:1226)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6431)
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)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.multidex.MultiDexApplication" on path: DexPathList[[zip file "/data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/lib/x86, /data/app/com.companyname.app1-S2R0G2ABxfLbmKhyk54SLg==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
at android.app.Instrumentation.newApplication(Instrumentation.java:1148)
at android.app.LoadedApk.makeApplication(LoadedApk.java:1218)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6431) 
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) 
I've played around with Linking options, but they all result in the same result.
A simple project can be found here:
https://drive.google.com/file/d/1oihKvJnRjxGiOaa2JS0FYKlQYI615p91/view?usp=sharing
Any help is highly appreciated!
When enabling multidex the correct multidex library (either com.android.support:multidex:1.0.3 or androidx.multidex:multidex:2.0.1) has to be used. As class androidx.multidex.MultiDexApplication is missing use androidx.multidex:multidex:2.0.1. Could be that the project template in Xamarin defailts to com.android.support:multidex:1.0.3.
See Multidex support prior to Android 5.0 for details.

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

java.lang.ClassNotFoundException: com.google.android.gms.common.GoogleApiAvailability Occurs when try to integrate arcore with mediapipe

I am working to integrate arcore and mediapipe application.But when I try to integrate arcore in mediapipe source code I get an issue with session object which is as under.
Getting following issue when try to create Session Object of ARCore
E/ARCore-AuthenticationManager: Exception during AuthenticationManager construction:
com.google.android.gms.common.GoogleApiAvailability
java.lang.ClassNotFoundException: com.google.android.gms.common.GoogleApiAvailability
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at com.google.ar.persistence.AuthenticationManager.a(PG:72)
at com.google.ar.persistence.AuthenticationManager.(PG:4)
at com.google.ar.persistence.AuthenticationManagerFactory.create(PG:3)
at com.google.ar.core.Session.nativeCreateSessionAndWrapper(Native Method)
at com.google.ar.core.Session.(Session.java:5)
at com.example.handtrackinggradle.MainActivity.startCamera(MainActivity.java:324)
at com.example.handtrackinggradle.MainActivity.onResume(MainActivity.java:171)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1416)
at android.app.Activity.performResume(Activity.java:7609)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4013)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4053)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState
(TransactionExecutor.java: 145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1955)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7076)
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:965)
Caused by: java.lang.ClassNotFoundException: Didn't find class
"com.google.android.gms.common.GoogleApiAvailability" on path: DexPathList[[zip file
"/data/app/com.example.handtrackinggradle-
p0OQ0rOqD7I0DpvWKOl4_A==/base.apk"],nativeLibraryDirectories=
[/data/app/com.example.handtrackinggradle-p0OQ0rOqD7I0DpvWKOl4_A==/lib/arm64,
/data/app/com.example.handtrackinggradle-p0OQ0rOqD7I0DpvWKOl4_A==/base.apk!/lib/arm64-
v8a, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:1
I solved this issue by adding following dependency.This issue is caused because of AR Session which is dependent on the below dependency
com.google.android.gms:play-services-auth:17.

Categories

Resources