我正在学习使用 Android Studio 3.1.4 在 WearOS 下开发表盘。我的调试器有问题。
看来我无法直接在调试模式下运行应用程序(Shift-F9)。如果这样做,尽管已在手表(模拟器或真实手表(Huawai Watch 2))上进行了授权调试,但我会系统地收到以下消息:
08/24 09:03:00: Launching wearmodule
$ adb push /path/wearmodule/build/outputs/apk/debug/wearmodule-debug.apk /data/local/tmp/com.example.wearmodule
$ adb shell pm install -t -r "/data/local/tmp/com.example.wearmodule"
Success
Waiting for application to come online: com.example.wearmodule.test | com.example.wearmodule
Waiting for application to come online: com.example.wearmodule.test | com.example.wearmodule
Waiting for application to come online: com.example.wearmodule.test | com.example.wearmodule
Connecting to com.example.wearmodule
Waiting for application to start debug server
Waiting for application to come online: com.example.wearmodule.test | com.example.wearmodule
Connecting to com.example.wearmodule
Waiting for application …Run Code Online (Sandbox Code Playgroud) 我试图通过Google Play开发者控制台提交我新创建的Android Wear表盘.问题是已禁用定价和分发部分中的"在Android Wear上分发您的应用"复选框.我不明白为什么.
我做了什么:
1)Android Wear的上传截图
2)在封闭的Beta版本中上传了2个APK文件.两个文件都使用一个密钥签名,具有不同的版本名称.首先是手机apk with embedded wear apk(minSdkVersion 23),second - standalone wear apk(minSdkVersion 25)有meta-data android:name ="com.google.android.wearable.standalone"android:value ="true"in manifest文件.
Everythings似乎很好,应用程序已准备好在生产中发布,除了"在Android Wear上分发您的应用程序"复选框,该复选框仍然处于禁用状态.我错过了什么?
我正在学习如何在 Android Studio 下开发表盘。我在调试器方面遇到了烦人的问题,这使得使用起来很痛苦。
当我想在调试模式下运行我的脸时,我不断收到以下消息:
...
Waiting for application to come online: com.example.wearmodule.test | com.example.wearmodule
Waiting for application to come online: com.example.wearmodule.test | com.example.wearmodule
Waiting for application to come online: com.example.wearmodule.test | com.example.wearmodule
Waiting for application to come online: com.example.wearmodule.test | com.example.wearmodule
Could not connect to remote process. Aborting debug session.
Run Code Online (Sandbox Code Playgroud)
我似乎唯一的选择是首先在运行模式下执行我的脸,然后将调试器附加到进程。然而,很多时候我不能,因为“确定”按钮是灰色的,如屏幕截图所示:
幸运的是,当我可以附加调试器时,它会在几秒/分钟后不断断开连接,并显示以下消息:
Disconnecting run session: a new debug session will be established.
Run Code Online (Sandbox Code Playgroud)
但没有建立其他会话。这使得调试的过程变得极其不舒服。
我是否错过了 Android Studio 配置中的某些内容?
编辑:可能值得注意的是,即使我只是尝试运行应用程序,我也经常不断收到消息Client not ready yet...。在这些情况下,我必须重新启动模拟器。每次尝试运行该应用程序都会发生这种情况,这让我浪费了很多时间。
我尝试使用以下指南阅读 Android Wear(三星 Galaxy Watch 4)的步行步骤:https://developer.android.com/training/wearables/health-services/active。
这是我的代码的一部分:
val healthClient = HealthServices.getClient(this /*context*/)
val measureClient = healthClient.measureClient
lifecycleScope.launch {
val capabilities = measureClient.capabilities.await()
supportsStepCount =
DataType.WALKING_STEPS in capabilities.supportedDataTypesMeasure
}
Run Code Online (Sandbox Code Playgroud)
但我收到这个异常:
Connection to service is not available for package 'com.google.android.wearable.healthservices' and action 'com.google.android.wearable.healthservices.MeasureClient'.
2021-09-07 11:04:18.112 4523-6821/com.daftar.galaxyface E/ServiceConnection: Connection disconnected and maximum number of retries reached.
java.util.concurrent.CancellationException: Service not available
at androidx.health.services.client.impl.ipc.internal.ServiceConnection.connect(ServiceConnection.java:145)
at androidx.health.services.client.impl.ipc.internal.ServiceConnection.enqueue(ServiceConnection.java:203)
at androidx.health.services.client.impl.ipc.internal.ConnectionManager.handleMessage(ConnectionManager.java:123)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)
Run Code Online (Sandbox Code Playgroud)
注意:上面的指南中有一个注释是获取权限,但没有提到哪些权限。我尝试了 ACTIVITY_RECOGNITION 和 BODY_SENSORS 和 ACCESS_FINE_LOCATION,但没有成功。
watch-face-api watchface android-wear-2.0 wearables samsung-galaxy-watch
我想从我的 xcode 项目生成 .watchface 文件。有没有办法从默认手表应用程序外部创建 .watchface 文件?
我找到了一个网站Facer,他们在那里提供自定义选项并从他们的网站生成 .watchface。他们采用什么方法?
我想尝试 garmin WachFace,但很快就遇到了folgnden 错误,但不幸的是我不知道为什么会发生这种情况,也许有人可以帮助你?
Cannot find symbol ':setText' on type 'PolyType<Null or $.Toybox.WatchUi.Drawable>'
Run Code Online (Sandbox Code Playgroud)
我使用以下代码:
function onUpdate(dc as Dc) as Void {
setClockDisplay();
setDateDisplay();
setBatteryDisplay();
setStepCountDisplay();
setStepGoalDisplay();
setNotificationCountDisplay();
setHeartrateDisplay();
// Call the parent onUpdate function to redraw the layout
View.onUpdate(dc);
}
private function setClockDisplay() {
var clockTime = System.getClockTime();
var timeString = Lang.format("$1$:$2$", [clockTime.hour, clockTime.min.format("%02d")]);
var view = View.findDrawableById("TimeLabel");
view.setText(timeString);
}
}
Run Code Online (Sandbox Code Playgroud)
所有 .setText() 都会引发错误。在这种情况下9次
我已经尝试了我能想到的一切。