Using Ice on Android

This page provides important information for users of the Ice for Java distribution.

On this page:

Overview of Ice on Android


Ice is available for Android through the Ice for Java distribution. To develop an Ice application for Android you will need the following components:

You can use either the Java or the Java Compat mapping in your Android project. Note however that the Java mapping uses Java 8 language features and currently requires the Java 8 toolchain provided in Android Studio 3.

Configuring an Android Studio project

Android Studio uses a Gradle-based build system. Using Ice requires modifying your project's build.gradle settings file(s) to include the Ice JAR files. For convenience we recommend using the Ice Builder for Gradle plug-in to help automate the compilation of your Slice files.

The following snippets give an example of configuring the Ice and Ice Builder for Gradle sections for an Android project.

Ice build.gradle configuration
buildscript {
    repositories {
        mavenCentral()
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "gradle.plugin.com.zeroc.gradle.ice-builder:slice:1.4.5"
    }
}
apply plugin: 'java'
apply plugin: 'slice'
slice {
    java {
        srcDir = '.'
    }
}
dependencies {
    compile 'com.zeroc:ice:3.7.1'
}


Using the Sample Programs

Sample programs are available at the ice-demos GitHub repository. You can browse this repository to see build and usage instructions for all supported programming languages. Simply clone this repository:

git clone -b 3.7 https://github.com/zeroc-ice/ice-demos.git
cd ice-demos

You can then import the directory java/android or java-compat/android into Android Studio.