App crashes with java.lang.UnsatisfiedLinkError for Oreo devices with Xamarin.Android

倖福魔咒の 提交于 2019-12-23 05:14:00

问题


I'm receiving crash reports in Google Play Console for my app, and the stacktrace is as follows:

java.lang.UnsatisfiedLinkError: 
  at mono.android.Runtime.register (Native Method)
  at md5f3dc63ecaad575af71bd7a9b1622f75b.n.<clinit> (n.java:20)
  at java.lang.Class.newInstance (Native Method)
  at android.app.ActivityThread.handleCreateBackupAgent (ActivityThread.java:3431)
  at android.app.ActivityThread.-wrap3 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1813)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:180)
  at android.app.ActivityThread.main (ActivityThread.java:6944)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:240)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:835)

I'm using Xamarin.Android with Visual Studio for my development, and the app is targeting for Android Pie (API 28). The crash only happens for Android 8.0 and 8.1 devices (which are capable of arm64-v8a, not sure it's just a coincidence, most devices running Oreo are running in 64-bit anyways).

The class n in the stacktrace is my implementation of BackupAgent. This happens once everyday or every 2 days, and it seems (not 100% sure yet) that Auto Backup is still running without problem with the error.

The problem has been around for almost a month, and I tried a couple of things but they don't seem to make any difference:

  1. Releasing with and without arm64-v8a
    • This eliminates the cause from mono library for 64-bit support
  2. Releasing with and without obfuscation
    • I'm using Dotfuscator Community Edition
    • Same crash reports but just the class name is revealed
  3. Installing the app through Play Store and locally with signed APK
    • This suggests that there is nothing to do with the installation method

I also tried to remove my custom BackupAgent class and make use of the default BackupAgent, the problem was gone. I need to add extra logic in my BackupAgent though, so this is a no-go for me.

Anyone having a similar problem? It would be nice if I could be guided with some clues to the problem. Thanks.

来源:https://stackoverflow.com/questions/53736243/app-crashes-with-java-lang-unsatisfiedlinkerror-for-oreo-devices-with-xamarin-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!