【发布时间】:2023-04-08 06:45:01
【问题描述】:
我正在尝试从手持设备向穿戴式模拟器发送消息, (根据this tutorial)。 不幸的是,我的 WearableListenerService.onMessageReceived 没有被调用。
在这里,我读过它可能与 gradle.build 文件有关,
我的“移动”模块(手持)中的 gradle.build:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.benji.data"
minSdkVersion 15
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.google.android.gms:play-services-wearable:+'
}
我的 gradle.build 在“磨损”模块中:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.benji.data"
minSdkVersion 20
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:+'
compile 'com.google.android.gms:play-services-wearable:+'
}
我已经按照前面提到的教程设置了所有其他内容。
感谢任何可能的答案
【问题讨论】:
-
您在 Manifest 中注册了吗?
-
@Gabriele 是的 + 我已经发布了一个解决方案。