We are using Agora to handle VoIP calls in our app. On most devices, it works just fine, but we see thousands of crashes a month occurring when the app tries to initialize RTM. Although it isn’t exclusively happening on Oppo devices, they are a supermajority of affected devices. This is spread across Android OS versions, from 7 – 14.
An abbreviated stack trace for your reference:
Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myapp/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp/lib/arm64, /data/app/com.myapp/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libagora-rtm-sdk-jni.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:972)
at java.lang.System.loadLibrary(System.java:1530)
at io.agora.common.AgoraServiceJNI.ensureNativeInitialized(AgoraServiceJNI.java)
at io.agora.common.AgoraServiceJNI.<clinit>(AgoraServiceJNI.java)
at io.agora.common.AgoraServiceJNI.nativeLog(AgoraServiceJNI.java)
at io.agora.common.Logging.log(Logging.java)
at io.agora.common.Logging.e(Logging.java)
at io.agora.rtm.internal.CommonUtility.<init>(CommonUtility.java)
at io.agora.rtm.internal.RtmManager.createRtmInstance(RtmManager.java)
at io.agora.rtm.RtmClient.createInstance(RtmClient.java)
I did some research into this particular error, and came across this StackOverflow. I confirmed we do have the ndk configuration recommended as a solution in our build.gradle:
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a'
}
as well as specifying the srcDirs (another suggestion):
main {
jniLibs.srcDirs = ['libs']
}
I’m suspicious that the problem is actually the one described in this article about The Perils of Loading Native Libraries on Android, which the author offers up a solution via the ReLinker library. Apparently this can occur when Android’s PackageManager install has a problem that causes the native libraries inside of the APK to not be extracted.
Please advise on whether there are changes we can make on our end to resolve this crash, or perhaps you have already addressed this and we just need to update our Agora SDKs.
Chantell Osejo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.