-
Notifications
You must be signed in to change notification settings - Fork 0
Gradle and Intellij IDEA
Intellij IDEA supports Gradle projects out of the box. As such, you don't have to drop down onto the command line to generate Intellij IDEA projects. Open Intellij IDEA, and select Import Project, then select to the build.gradle file in the root folder of your project and press OK. In the next dialog leave all settings as they are and hit OK. That's it!
Let gradle generate the Intellij Idea project:
./gradlew idea
Once gradle is done with generating the project file, you can open this with Idea:
- File -> Open
- Select the .ipr file from the root directory, hit 'OK'
You'll need to set the Android SDK for the android module:
- File -> Project Structure
- Select 'modules' in the panel on the left
- Select the android module
- Set the module SDK to the android SDK that you configured for IntelliJ
Intellij has gradle support bundled, so you can import a gradle project without installing any additional plugins.
To do this: File > Import Project, locate and choose the build.gradle in the root directory of the project and press ok.
Keep the settings as default unless you know that you want to use a customized gradle wrapper or your local distribution. Hit OK, and it will start the import of the project and pulling in the default dependencies.
Gradle in Intellij does not like any source paths that are outside of the content root. For example setting the resource directory for the desktop project as the android assets folder, this will cause a gradle refresh to fail. There are currently only a few solutions for this problem, and none of them are that ideal. The developers have said that it will someday play nice, but as for now you can do the following:
- Don't use gradle tasks to run tasks that would require the content out of the root and keep the asset directories as 'wrong'
- Copy assets to each project
- Don't use the gradle IDE integration, run from command line and import as a file system
At the top window hit Run > Edit configurations, a dialog will pop up. Click Application on the left and use the little green + to create a new run configuration.
If you click the ... on the right hand side, you will be able choose from launchers in your projects. Choose the DesktopLauncher.
Next you need to change the working directory to where your assets are. The usual way to do this is access everything from the android/assets folder as shown in the image.
Finally choose the desktop module for classpath. Give it a run!
At the top of the window hit Run > Edit configurations, a dialog will pop up. Click on Android Application on the left and if there is no project defined there, use the little green + to add a new configuration.
All the settings here are fairly straight forward, make sure you have the module selected as the android module, if you have multiple activities you can choose which one you want to launch.
Under target device, you can select if you want to run on an actual device or god forbid an emulator.
Hit ok, give it a run!
-
Developer's Guide
- Introduction
- Goals & Features
- Community & Support
- Contributing
- Games Built with Libgdx
- Prerequisites
- Gradle Project Setup, Running, Debugging and Packaging
- Project Setup, Running & Debugging
- Third Party Services
- Working from Source
- Using libgdx with other JVM languages
- The Application Framework
- A Simple Game
- File Handling
- Networking
- Preferences
- Input Handling
- Memory Management
- Audio
-
Graphics
- Configuration & Querying Graphics ??
- Fullscreen & VSync
- Continuous & Non-Continuous Rendering
- Clearing the Screen
- Take a Screenshot
- OpenGL ES Support * Configuration & Querying OpenGL ?? * Direct Access ?? * Utility Classes * Rendering Shapes * Textures & TextureRegions * Meshes * Shaders * Frame Buffer Objects
- 2D Graphics * SpriteBatch, TextureRegions, and Sprite * 2D Animation * Clipping, with the use of ScissorStack * Orthographic camera * Mapping Touch Coordinates ?? * Viewports * NinePatches * Bitmap Fonts * Distance field fonts * Using TextureAtlases * Pixmaps * Packing Atlases Offline * Packing Atlases at Runtime * 2D Particle Effects * Tile Maps * scene2d * scene2d.ui * Skin
- 3D Graphics * Quick Start * Models * Material and environment * 3D animations and skinning * Importing Blender models in LibGDX * Perspective Camera ?? * Picking ??
- Managing Your Assets
- Utilities
-
Math Utilities
- Interpolation
- Vectors, Matrices, Quaternions
- Circles, Planes, Rays, etc.
- Path interface & Splines
- Bounding Volumes ??
- Intersection & Overlap Testing ??
- Physics
- Tools
- Extensions
- Deploying your Application
- Building Libgdx ??
- Known Issues
- Articles
- Deprecated (May be outdated)