Android Troubleshooting

Android Dependencies

Follow this guide if you are having trouble finding classes or dependencies. The Urban Airship Library SDK requires Android Support v4 library and (revision 22 or newer), Android Support v7 CardView library (revision 22 or newer, required for in-app messaging) and Google Play Service GCM and Location (version 7.5 or newer) for Android.

Using Android Studio

  1. Click the SDK Manager icon in the toolbar to launch the SDK Manager.
  2. Open the Extras directory and verify if Android Support Library revision 22.+ is installed. If not, select Android Support Library then click on the Install packages... button. In the next window, double-click the package name on the left to accept the license agreement then click Install.
  3. After downloading the Android Support Library using the SDK Manager, open the build.gradle file for your application.
  4. Add the support library to the dependencies section. For example, to add the v7 CardView and v4 support libraries, add the following lines:
dependencies {
    compile project (':urbanairship-lib-x.x.x')
    compile 'com.android.support:support-v4:22.+'

    // Recommended for in-app messaging
    compile 'com.android.support:cardview-v7:22.0.0'
}
  1. Launch the SDK Manager and open the Extras directory.
  2. Verify if Google Repository and Google Play services are installed. If not, select Google Repository and/or Google Play services then click on the Install packages... button. In the next window, double-click the package name on the left to accept the license agreement then click Install.
  3. After downloading the Google Play services SDK, open the build.gradle file for your application.
  4. Add a new build rule under dependencies for the latest version of play-services. For example:
dependencies {
    compile project (':urbanairship-lib-x.x.x')
    compile 'com.android.support:support-v4:22.+'

    // Required for Android push notifications
      compile 'com.google.android.gms:play-services-gcm:7.5.0'

    // Recommended if using location services
    compile 'com.google.android.gms:play-services-location:7.5.0'
}
  1. Be sure to update this version number each time Google Play services is updated.
  2. Save the changes and click Sync Project with Gradle Files icon in the toolbar.
  3. Open your app’s manifest file and add the following tag as a child of the <application> element:
<meta-data android:name="com.google.android.gms.version"
       android:value="@integer/google_play_services_version" />

Android Push

Follow this if you are having trouble receiving push notifications.

  1. Verify push is really enabled on your app. On your device, go to Settings > Apps, then click on your app and verify the Show notifications checkbox is checked.
  2. Verify your airshipconfig.properties file located in your project’s assets folder contains the correct application key, application secret and gcmSender (required for GCM only).
  3. For Amazon apps, verify you have the correct api_key.txt file located in your project’s assets folder.
  4. Verify your AndroidManifest.xml file contains all the required permissions, services, activities, receivers, etc. for Urban Airship, GCM and/or ADM. It might be helpful to compare it with our Sample’s AndroidManifest.xml. You can set the inProduction flag to false and look at logcat for manifest errors.
  5. Check your logcat for errors or warnings, which may provide valuable hints during debugging. The log level can be modified in the airshipconfig.properties file and defaults to VERBOSE for development apps and ERROR for production apps.
  6. Verify your device’s network connection. Push notifications will not be delivered without a network connection. Unstable network connection may potentially prevent push notifications from arriving.