Libgdx, Transitive dependencies Android,Java library project, Jar

后端 未结 2 1482
清歌不尽
清歌不尽 2021-01-22 17:56

I have just created template Libgdx project (Core,Android,Windows). Core is regular Java project library. There is a dependency in Core to XStream.jar library. Core contains fil

相关标签:
2条回答
  • 2021-01-22 18:08

    If the library is supported on Android, it will work.

    Put it in the Core project's "libs" folder. Add it to its Order & Export tab.

    Add it to the Libraries tab of the Android Project. ("Add jars", not "Add external jars") And then check it in the Order & Export tab aswell.

    That means that projects that depend on the main project will also have gdx.jar on their classpath. However, this doesn't work for Android projects.

    This just means that the libraries in the classpath of the Core project aren't automatically added to the Android project (As far as I know, some time ago it did).

    If you get the Multiple dex files error. Uncheck private libraries in the Order & Export tab of the Android project.

    0 讨论(0)
  • 2021-01-22 18:15

    You need to fix your

    compile fileTree(dir: 'libs', include: '*.jar')
    

    line. If your libs folder is in core project's folder, add above line to

    project(":core") {...
    
        dependencies {....
            compile fileTree(dir: 'libs', include: '*.jar')
        }
    }
    

    part of your build.gradle file. And add below line to your Android project's part in the build.gradle file.

    project(":android") {...
    
        dependencies {....
            compile fileTree(dir: '../libs', include: '*.jar')
        }
    }
    

    Android must have this line but it is not necessary for other projects.

    0 讨论(0)
提交回复
热议问题