Libgdx, Transitive dependencies Android,Java library project, Jar

老子叫甜甜 提交于 2019-12-02 01:53:12

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!