Search code examples
androidandroid-emulatorjava-native-interface

How to make native library optional


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?


Solution

  • 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.