Couldn't load shared library 'gdx' for target

后端 未结 4 970
没有蜡笔的小新
没有蜡笔的小新 2021-01-18 17:18

I\'m having the same issue as in this question, but the answers there doesn\'t solve my problem.

I didn\'t create project by gdxsetup.jar, I just included gdx.jar an

4条回答
  •  既然无缘
    2021-01-18 17:38

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

提交回复
热议问题