BuildStendhalForAndroid: Difference between revisions

From Arianne
Jump to navigation Jump to search
Content deleted Content added
imported>AntumDeluge
imported>AntumDeluge
Gradle: changes to instructions
Line 50: Line 50:
</pre>
</pre>


'''NOTE:''' On Windows, if you used Android Studio to download the SDK, it will be located in <span style="color:green;">C:\\Users\\<username>\\AppData\\Local\\Android\\Sdk</span>.
'''''NOTE:''' On Windows, if you used Android Studio to download the SDK, it will be located in <span style="color:green;">C:\\Users\\<username>\\AppData\\Local\\Android\\Sdk</span>.''


From a command line or terminal, move into the <span style="color:green;">android</span> sub-directory & execute the following.
There are three build types available: <span style="color:darkgreen;">assembleRelease</span>, <span style="color:darkgreen;">assemblePrerelease</span>, & <span style="color:darkgreen;">assembleDebug</span>. From a command line or terminal, move into the <span style="color:green;">android</span> sub-directory & execute the following.


Unix/Linux example:
Unix/Linux example:
<pre>
<pre>
# with env variable set or sdk.dir set in local.properties
# with env variable set or sdk.dir set in local.properties
$ ./gradlew build
$ ./gradlew assembleRelease


# manually setting env variable
# manually setting env variable
$ ANDROID_SDK_ROOT="/path/to/sdk/root" ./gradlew build
$ ANDROID_SDK_ROOT="/path/to/sdk/root" ./gradlew assembleRelease
</pre>
</pre>


Line 66: Line 66:
<pre>
<pre>
# with env variable set or sdk.dir set in local.properties
# with env variable set or sdk.dir set in local.properties
> gradlew build
> gradlew assembleRelease


# manually setting env variable (do not use quotes)
# manually setting env variable (do not use quotes)
> set ANDROID_SDK_ROOT=C:\\path\\to\\sdk\\root
> set ANDROID_SDK_ROOT=C:\\path\\to\\sdk\\root
> gradlew build
> gradlew assembleRelease
</pre>
</pre>

If <span style="color:darkgreen;">build</span> is used as the argument (<code>gradlew build</code>), it will execute all build types.

'''''NOTE:''' For <span style="color:darkgreen;">assemblePrerelease</span> & <span style="color:darkgreen;">assembleDebug</span> to succeed, you must have the Android debugging keystore installed in your home directory. <span style="color:darkgreen;">assembleRelease</span> does not sign the .apk package. It will [https://developer.android.com/studio/publish/app-signing need to be signed] to work on most Android systems.''


After build completes, the resulting .apk packages will be located in <span style="color:green;"><source root>/build/build_android_client/outputs/apk</span>.
After build completes, the resulting .apk packages will be located in <span style="color:green;"><source root>/build/build_android_client/outputs/apk</span>.

Revision as of 07:43, 31 January 2022



WebView Client

Introduction

These instructions are for building the WebView client for the Android platform.

What is a WebView Client?

WebView is an application that allows embedding or linking to websites or HTML code inside Android apps. The Stendhal WebView client is an app that simply uses this technology to link to the Stendhal web client which is accessed at https://stendhalgame.org/client/stendhal.html.

Android SDK

The Android Software Development Kit (SDK) libraries are required. You will need to install these on your system. The minimum supported version is currently 21.

Building from IDE

Android Studio

instructions not yet available

Eclipse

instructions not yet available

Netbeans

instructions not yet available

Building from Command Line

IMPORTANT: Before you can build from the command line/terminal, you must have a Java compiler provided by a Java Development Kit (JDK) installed.

Gradle

The Gradle Build Tool is used for building. The necessary tools are already included with the source code. Two scripts are provided for executing the build: android/gradlew for Unix/Linux systems, & android/gradlew.bat for Windows.

In order for the build to complete, the scripts must know where the SDK libraries are located. The script will check the ANDROID_SDK_ROOT environment variable, or it will parse the value of sdk.dir in the android/local.properties file (NOTE: Windows users must use double backslashes for directories (\\)).

Example local.properties for Unix/Linux:

sdk.dir=/path/to/sdk/root

Example local.properties for Windows:

sdk.dir=C:\\path\\to\\sdk\\root

NOTE: On Windows, if you used Android Studio to download the SDK, it will be located in C:\\Users\\<username>\\AppData\\Local\\Android\\Sdk.

There are three build types available: assembleRelease, assemblePrerelease, & assembleDebug. From a command line or terminal, move into the android sub-directory & execute the following.

Unix/Linux example:

# with env variable set or sdk.dir set in local.properties
$ ./gradlew assembleRelease

# manually setting env variable
$ ANDROID_SDK_ROOT="/path/to/sdk/root" ./gradlew assembleRelease

Windows cmd example (note that you do not need to include the ".bat" filename extension):

# with env variable set or sdk.dir set in local.properties
> gradlew assembleRelease

# manually setting env variable (do not use quotes)
> set ANDROID_SDK_ROOT=C:\\path\\to\\sdk\\root
> gradlew assembleRelease

If build is used as the argument (gradlew build), it will execute all build types.

NOTE: For assemblePrerelease & assembleDebug to succeed, you must have the Android debugging keystore installed in your home directory. assembleRelease does not sign the .apk package. It will need to be signed to work on most Android systems.

After build completes, the resulting .apk packages will be located in <source root>/build/build_android_client/outputs/apk.

Ant

As with other instructions on building from the command line, the Android client can also be built with an Apache Ant target. The same conditions related to invoking the Gradle scripts directly apply to using ant.

From the Stendhal source root directory, execute the following.

Unix/Linux example:

# with env variable set or sdk.dir set in local.properties
$ ant dist_client_android

# manually setting env variable
$ ANDROID_SDK_ROOT="/path/to/sdk/root" ant dist_client_android

Windows cmd example:

# with env variable set or sdk.dir set in local.properties
> ant dist_client_android

# manually setting env variable (do not use quotes)
> set ANDROID_SDK_ROOT=C:\\path\\to\\sdk\\root
> ant dist_client_android

The resulting .apk packages will be located in the <source root>/build directory.