I am receiving a crash with the following message while migrating an AppCompatActivity to a WearableActivity.
Caused by: java.lang.IllegalStateException:
Without seeing your AndroidManifest the only suggestion I can make is the following:
uses-library should be application level, not manifest level. Your AndroidManifest should look like this:
<manifest
package="com.yourpackage.app_package"
xmlns:android="http://schemas.android.com/apk/res/android">
<uses-feature android:name="android.hardware.type.watch"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault">
<uses-library android:name="com.google.android.wearable" android:required="false" />
<activity
....
</activity>
</application>
</manifest>
Consider: http://developer.android.com/guide/topics/manifest/uses-library-element.html
Might want to useAmbientMode.AmbientCallbackProvider
instead of WearableActivity
.
It is the new preferred method and it still gives you all the stuff with WearableActivity
but you can keep using AppCompatActivity
.
Official docs call out the details (and example code).