Install Layer

Layer is distributed as a source code package or compiled bundle, and can be easily integrated into a new app or an existing codebase with standard tooling.

The Android SDK is built and designed to be used with Android Studio. The SDK is available as an AAR or JAR file hosted on Github, and can be added to your project by referencing the AAR remotely with Maven, or by importing the JAR locally.


Google has deprecated Android tooling for Eclipse, and as a result we no longer provide support for Eclipse-based workflows.

Option 1: Maven + AAR

Navigate to your build.grade file at the app level (not project level) and include the following:

repositories {
    maven { url "" }

dependencies {
    compile 'com.layer.sdk:layer-sdk:0.20.3'
    compile ''
    compile 'org.slf4j:slf4j-nop:1.5.8'

Option 2: Local JAR

  1. Download the latest Layer SDK JAR from Github
  2. Drag the JAR file into the /libs directory of your Android Studio application
  3. Navigate to the JAR file in the Android Studio navigator, right-click and select “Add As A Library…”
  4. Navigate to your build.gradle file and ensure that you include the following:
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ''
    compile 'org.slf4j:slf4j-nop:1.5.8'

Example AndroidManifest.xml

The Layer Android SDK requires some permissions and references from your app’s AndroidManifest.xml file. These permissions allow the SDK to monitor network state and receive Google Cloud Messaging messages. Below is an example with a com.myapp.package package; replace with your own package when merging with your own manifest.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""

    <!-- Standard permissions -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name=""/>

    <!-- Signature-only permissions -->
    <permission android:name="com.myapp.package.permission.LAYER_PUSH"
    <uses-permission android:name="com.myapp.package.permission.LAYER_PUSH"/>
    <permission android:name="com.myapp.package.permission.C2D_MESSAGE"
    <uses-permission android:name="com.myapp.package.permission.C2D_MESSAGE"/>

    <!-- LayerClient.sendLogs() permissions -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_LOGS"/>

       <!-- Your custom "com.layer.sdk.PUSH" notification Receiver -->
       <receiver android:name=".LayerPushReceiver">
             <action android:name="com.layer.sdk.PUSH"/>
             <category android:name="com.myapp.package"/>

       <!-- Layer's GCM Receiver and Service -->
       <receiver android:name=""
          <intent-filter android:priority="950">
             <action android:name=""/>
             <action android:name=""/>
             <category android:name="com.myapp.package"/>
       <service android:name=""/>

ProGuard support

If your project uses ProGuard, you may have to add the following settings to the ProGuard configuration file to ensure Layer builds correctly:

# Layer SDK
-keep class com.layer.** {*; }
-dontwarn com.layer.**

Verifying installation

To verify that everything is working, connect the client, then build and run your app.

Getting Started Connecting