Couldn't load shared library 'gdx' for target

The problem I had was that for some reason libgdx.so was not copied to any of the armeabi, armeabi-v7a or x86 folders in the android project's lib folder.

Copying these over from the libgdx distribution worked for me.


My problem was that I was trying to make my GDX app within a shared library (aka, not the thing that gets compiled into an APK), but hadn't finished setting up all the GDX-including stuff in my lib.

So I had:

MyProject
-->MyMainApp
-->-->build.gradle <-- no updates required, doesn't do anything with GDX
-->MySharedLibraryWhereMyGameEngineIs
-->-->build.gradle <-- this is where the problem was

In the shared lib's build.gradle, I hadn't included the sourceSets parameter.

Adding it fixed my problem. GDX now starts up successfully.

apply plugin: 'com.android.library'
android {
    ... config stuff ...

    sourceSets {                       // this wasn't here before
        main {                         // this wasn't here before
            jniLibs.srcDirs = ['libs'] // this wasn't here before
        }                              // this wasn't here before
        instrumentTest.setRoot('tests')// this wasn't here before
    }     

    ... a bunch of other config stuff ...
}