article

Amelia@Amazon avatar image
Amelia@Amazon posted

How to Avoid "Cannot Combine Swipe Dismissal and the Action Bar" Runtime Exception

Summary

Android has different API levels that define the different framework versions offered by the platform. As you can imagine, the higher the integer value, the more updated the framework is. This allows developers to target newer versions whilst still maintaining support for older versions of Android. Developers also have the ability to use the an AVD (Android Virtual Device) to test their application without the need for a real device. These can have specific attributes set to accommodate specific target devices and help with testing.

Recently, API 20 (Platform Version Android 4.4W) was released allowing developers to develop and deploy to wearable Android devices (and similarly, AVD's). For more information on Android and it's API levels, see here:

http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels

Issue

It is possible to create an Android wearable project at API 20 (4.4W) and deploy it to a non-wearable AVD. Though this will deploy, the app will crash almost instantly, and the following error code will be returned:

android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar

Resolution

There are 2 possible solutions for this:

If you are creating an Android application that isn't targetting a wearable device, you can easily get around this problem by targetting a normal API level. This can either be done by creating a new project and setting the API level appropirately (for example, API 19/20), or you can change the target SDK version in your AndroidManifest.xml in your current project. If you are creating an Android application that is targetting wearable devices, you must simply create or use a wear compatible AVD. For more information, see here:

https://developer.android.com/training/wearables/apps/creating.html#SetupEmulator

Keywords: Wear, RuntimeException, AVD, Manifest

KB_0026

androidlollipop
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Article

Contributors

brizzlebrazzle contributed to this article