Reputation: 825
Description: I've phone app and wear app - which works only with phone app. I've recently updated target and compile SDK to 27. I've been testing performance on Android P preview, but accidentally I've found problem on all devices.
Problem: Wear app can't communicate with phone app (and vice-versa) while installing both apps as "run" from Android Studio.
On the other hand - When I generate signed APK with key both release/debug versions of app communicate with each other (phone app & wear app) - OK
I have same "applicationId" for both apps. Also it does not seems to be problem related to code, as both app works on signed APKs.
Any idea what can be wrong?
Upvotes: 2
Views: 458
Reputation: 825
Resolved As mentioned in documentation: https://developer.android.com/training/wearables/data-layer/
Important: Your phone and Wear APK signatures and the signature schemes must to be identical for the DataLayer API to be able to successfully communicate between devices. This includes your usage of the v1 and/or v2 signature. Ensure the signature scheme is set correctly in build.gradle or when you use the Generate Signed APK wizard
I have added in each (Wearable and phone) build.gradle
android {
signingConfigs {
debug {
storeFile file("myKey.keystore")
}
}
...
}
about keystore.
When running or debugging your project from the IDE, Android Studio automatically signs your APK with a debug certificate generated by the Android SDK tools. The first time you run or debug your project in Android Studio, the IDE automatically creates the debug keystore and certificate in $HOME/.android/debug.keystore, and sets the keystore and key passwords.
source: https://developer.android.com/studio/publish/app-signing
Upvotes: 2