I am receiving a crash with the following message while migrating an AppCompatActivity to a WearableActivity.
Caused by: java.lang.IllegalStateException: Could not find wearable shared library classes. Please add uses-library android:name="com.google.android.wearable" android:required="false" /> to the application manifest
I was following this link for enabling ambient mode in my application: Keeping Your App Visible
I have the following in my manifest and gradle respectively:
<uses-library android:name="com.google.android.wearable"
android:required="false" />
…
minSdkVersion 22
targetSdkVersion 22
compile 'com.google.android.support:wearable:1.2.0'
provided 'com.google.android.wearable:wearable:1.0.0'
compile 'com.google.android.gms:play-services-wearable:7.5.0'
I have taken these directly from the link (hope I got that right).
My device is running the following versions:
Android Wear - 1.1.1.1929530
Google Play Services - 7.5.76 (2002306-534)
Android OS - 5.1.1
I'm guessing that the library that supplies android.support.wearable.activity.WearableActivity should be bundled on the device but isn't there.
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