1

I'm writing project which works with RFID scanner. SDK for this device uses native libraries which I put into src/main/jniLibs/arm64-v8a, armeabi, armeabi-v7a. This SDK does not have libraries for x86 architecture, so now I can't install this apk into emulator: installation fails with message Failed to finalize session : INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113. Is there any way to make this optional, so I could still install it and test unrelated features on fast x86 emulator?

vbezhenar
  • 11,148
  • 9
  • 49
  • 63
  • You can always create abstract class and one sub-class can implement it as native one, another as non-native one: http://jnicookbook.owsiak.org/recipe-no-030/ This way, you can easily define your env to work properly when you have native code, and fill it with dummy methods while working without native one. – Oo.oO Feb 11 '19 at 18:16

1 Answers1

1

You can check the system CPU before calling LoadLibrary, or catch the exception of LoadLibrary fails. You should isolate the RFID feature in a separate class that won't be loaded in your emulator tests.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • I don't call LoadLibrary. The problem is that I can't even install this apk on emulator. – vbezhenar Feb 09 '19 at 20:43
  • Installation failed with message Failed to finalize session : INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113. – vbezhenar Feb 09 '19 at 20:59
  • The easiest workaround is [to use splits](https://stackoverflow.com/a/33761604/192373) – Alex Cohn Feb 09 '19 at 21:52
  • 1
    Thanks, worked like a charm! Now my API call throws UnsatisfiedLinkError which I can process as needed. – vbezhenar Feb 10 '19 at 22:40