Reputation: 221
I have created a libGDX project in Android Studio. When I first created the project, I only selected the "Android" subproject.
Now, I have changed my mind and want to add a desktop platform module to my libGDX project in order to run the "Tools" extension. There doesn't seem to be another question asking this on stackoverflow, and that is why I am asking it. How can I achieve this?
Upvotes: 3
Views: 1301
Reputation: 20140
You know Project Name and package of your already generated libgdx project.
Generate another project with above details at some other place then copy the desktop folder in your old project.
Now you've to add that module in your project.
settings.gradle
filebuild.gradle
fileDone, Sync your project dependency.
EDIT
Content inside settings.gradle file should be like this :
include 'android', 'core', 'desktop'
Add below code in your project level build.gradle
file
project(":desktop") {
apply plugin: "java"
dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
}
}
Upvotes: 3
Reputation: 1160
I know this may not be what you are looking for but what I would do is generate another LibGDX project with the Project Setup app with desktop checked and copy-paste all my code into this new project, optionally, if you want the new project to have the same name rename previous as "previous-backup"
Remember to add a desktop configuration, here's a example from one of my projects:
Upvotes: 0