简体   繁体   中英

Create big Jar(desktop) of android/desktop gdx project

I've managed to setup, with use of the gdx project generator, a project, that runs both on android and desktop. (using Android Studio 0.8.2) The generator has generated several projects like, desktop, android, html, ios and core. (at the moment, i'm not interrested in ios/html)

My question is: How can I configure Gradle to build one big Jar file, I can run directly from windows, for the desktop configuration? (So I can spread my game as beta for friends)

I've seen something like this in my build.gradle:

task dist(type: Jar) {
    from files(sourceSets.main.output.classesDir)
    from files(sourceSets.main.output.resourcesDir)
    from { configurations.compile.collect { zipTree(it) } }
    from files(project.assetsDir);

    manifest {
        attributes 'Main-Class': project.mainClassName
    }

}

But this doesn't generate a complete Jar with resources (android assets)

(not sure, but I haven't found any big Jars yet)

如果你使用了gdx项目生成器(这个: https//github.com/libgdx/libgdx/wiki/Project-Setup-Gradle ),你应该可以使用这个命令创建你的runnable jar:

gradlew desktop:dist

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM