Forum Xamarin.Android

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

elvisonelvison Member ✭✭
edited December 2018 in Xamarin.Android

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.

Answers

  • YorkGoYorkGo CNMember, Xamarin Team Xamurai

    @elvison , would you mind share your BackupAgent code?

  • elvisonelvison Member ✭✭

    @YorkGo I'll have to discuss with my team first.

    I don't think there's anything to do with the logic in it. Basically we tried to remove all logic but just override OnCreate(), OnBackup(), OnRestore(), OnFullBackup(), OnRestoreFinished() and print some logs for debugging, and the problem is still there. It's <clinit> in the stacktrace but we don't have any static stuff.

  • YorkGoYorkGo CNMember, Xamarin Team Xamurai

    @elvison , will spend some time troubleshooting this issue. On the other hand, see you issue report here, waiting for their response.

  • elvisonelvison Member ✭✭

    Some updates here. After I updated my app with arm64-v8a support, the problem is still there after I updated the app in my testing Oreo devices. However, the problem did apparently go away after I uninstalled it and did a fresh installation. I had 4 Oreo testing devices, and I did that in 2 of them only, and the problem is gone for those 2 devices, so it's a controlled result.

Sign In or Register to comment.