UnsatisfiedLinkError: Couldn't load … from loa

2019-08-11 20:44发布

问题:

I'm using IntelliJ in Windows 7 and after a recent sudden change to my development system (not device) I'm stuck with the UnsatisfiedLinkError thrown by System.loadLibrary() for loading a native .so library

java.lang.UnsatisfiedLinkError: Couldn't load ... from loader 

I tried every fix suggested on SO with no success including:

  • Rebuilding the app and recreating modules structure from scratch
  • Cleaning IntelliJ cache and restarting Intellj

I have my .so libraries in the libs folder

  • libs
    • armeabi
    • x86

回答1:

The .so library which was not loading was in my main app. The main app is dependent on another module named X which have a .so file in the following hierarchy:

  • libs
    • armeabi-v7a

I've noticed that adding this module to the project prevented main module native libs to be loaded.

It seems that there's a conflict between both libs folders so the only crazy fix that let both .so files get loaded was to rename armeabi-v7a folder in module X to armeabi and now everything is OK.