Reputation: 19868
When I push the APK onto the phone with an embedded Wear App, and then go to Start..., then try to run my application, it crashes on the watch. The Exception is a ClassNotFoundException.
09-18 14:53:17.678: E/AndroidRuntime(2391): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.myapp/com.myapp.WearActivity}: java.lang.ClassNotFoundException: Didn't find class "com.myapp.WearActivity" on path: DexPathList[[zip file "/data/app/com.myapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.myapp-1, /vendor/lib, /system/lib]]
I have declared this Activity in my wearable AndroidManifest.xml file.
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault" >
<activity
android:name=".WearActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have also double checked that the package name aligns with whats declared above, and it does.
In the build.gradle file for the wearable module, I have proguard turned off
buildTypes {
release {
runProguard false
signingConfig signingConfigs.release
}
}
Really not sure what else would be preventing the OS from finding the Activity. Any ideas?
Upvotes: 0
Views: 688
Reputation: 19868
It turns out that the following build.gradle entries were conflicting.
Mobile
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'
Wear
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
Mobile
compile 'com.google.android.gms:play-services:5.0.77'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.android.support:appcompat-v7:20.0.0'
Wear
compile 'com.google.android.support:wearable:1.0.0'
compile 'com.google.android.gms:play-services-wearable:5.0.77'
Upvotes: 1