Skip to content

Setting up IntelliJ IDEA (Linux, WIndows, OSX)

Andreas Eberle edited this page Apr 21, 2016 · 5 revisions

Warning: This seems to work fine for OSX but IntelliJ seems to have problems on Linux.

Clone the repository

git clone https://github.com/jsettlers/settlers-remake.git # clone the repository
cd settlers-remake                                         # change into the settlers remake folder

This should have created a new directory: settlers-remake

Install Android SDK

Linux

Linux users download the command line tools at the bottom of the Android SDK page.

Windows

Windows users have two options:

  • download Android Studio(which can be used as alternative to IntelliJ) and install the AndroidSDK during the installation process by following the instrctions
  • or download the command line tools at the bottom of the Android SDK page.

OSX

# Mac
brew install android # install SDK Manager
android              # start SDK Manager GUI

When you have the Android SDK Manager installed...

open it and select the following packages.

Install the following items

  • Tools/Android SDK Build-tools version 23.0.1
  • Android 4.0.3 (API 15)/SDK Platform
  • Android 4.0.3 (API 15)/Google APIs
  • Android 4.0.3 (API 15)/Sources for Android SDK

Create local.properties file in settlers-remake folder to tell IntelliJ IDEA where to find the Andoid SDK

echo "sdk.dir=/usr/local/opt/android-sdk" >> local.properties

Start IntelliJ IDEA

Run the application once with Gradle to prepare the settlers-remake folder for IntelliJ IDEA

./gradlew run

Download the IntelliJ IDEA Community Edition and start it.

Click Import Project

Select settlers-remake/build.gradle and click OK

In Import Project from Gradle dialog click OK

In Gradle Project Data to Import dialog click OK

Run using Swing

In the project jsettlers.main.swing, find the class SwingManagedJSettlers. Run it.

NPE on run

When you cannot run the settlers application and experience a NullPointerException on start, you cannot run the application from inside IntelliJ idea.

There seems to be a bug where IntelliJ does not recognize different classes and resources directories. This is why the resources are missing in the classpath. I did not find any way to fix this.

For now, you can use Android Studio (which is based on IntelliJ), Eclipse or run it manually using ./graldlew run