Next up, you need to import your project into your IDE.
Importing the Project
- IntelliJ IDEA or Android Studio, you can choose to open the
build.gradlefile and select “Open as Project” to get started. Eclipse, chooseFile -> Import... -> Gradle -> Existing Gradle Project(make sure that your freshly generated project is not located inside of your workspace). NetBeans it isFile -> Open Project. - You may need to refresh the Gradle project after the initial import if some dependencies weren’t downloaded yet.
IntelliJ IDEA/Android Studio, the
Reimport all Gradle projectsbutton is a pair of circling arrows at the top left in the Gradle tool window, which can be opened withView -> Tool Windows -> Gradle. Eclipse right click on your projectGradle -> Refresh Gradle Project.Getting it Running
If you want to execute your freshly imported project, you have to follow different steps, depending on your IDE and the platform you are targeting.Desktop
In IDEA/Android Studio:
- 2. Alternatively, you can create a run configuration:
core/assetsfolder (orandroid/assetsif you are using an Android subproject) 5.In Eclipse:
DesktopLauncherclasscore/assets(orandroid/assetsif you are using an Android subproject)In NetBeans:
Right click the desktop project -> RunAndroid
- IDEA/Android Studio: Right click AndroidLauncher -> Run AndroidLauncher
- Eclipse: Right click Android project -> Run As -> AndroidApplication
- NetBeans: Right click Android project -> Run As -> AndroidApplication
iOS
In IDEA/Android Studio
- 2.
- 2.
documentation.
In Eclipse
- documentation.HTML
HTML is best suited to be run on command line. You are welcome to manually setup GWT in the IDE of your choice if you are familiar with it, but the recommended way is to drop down to terminal or command prompt. Super Dev mode, which allows you to recompile on the fly, and debug your application in browser. To do so, open up your favourite shell or terminal, change directory to the project directory and invoke the respective gradle task:
On Unix: If you get a permission denied error, set the execution flag on the gradlew file:./gradlew html:superDev
chmod +x gradlewYou should see lots of text wizzing by, and if all goes well you should see the following line at the end: , to see your application running, with a recompile button. GWT documentation.Command Line
All the targets can be run and deployed to via the command line interface. Desktop:
Android:./gradlew desktop:run
./gradlew android:installDebug android:run
ANDROID_HOMEenvironment variable needs to be pointing to a valid android SDK before you can do any command line wizardry for Android. On Windows, use:set ANDROID_HOME=C:/Path/To/Your/Android/Sdk; on Linux and macOS:export ANDROID_HOME=/Path/To/Your/Android/Sdk. Alternatively you can create a file called “local.properties” with the following content:sdk.dir /Path/To/Your/Android/Sdk. iOS:
HTML:./gradlew ios:launchIPhoneSimulator
../gradlew html:superDev
Gradle tasks are failing?
--debugparameter to the command, e.g.:
This will provide you with a stacktrace and give you a better idea of why gradle is failing../gradlew desktop:run --debug
What to do next?
A Simple Game for a step-by-step guide.
