我正在測試/使用我正在開發的Android Wear表面測試/使用手持伴侶配置活動時出現的一些問題。雖然我並不陌生於Android開發,但這是我的第一個錶盤應用程序,所以如果其中一些問題很明顯,請向我介紹相應的文檔。模擬器中的Android Wear表面伴侶配置測試
我有我的可穿戴模塊和手持模塊。目前手持設備模塊只有一項活動作爲配套配置。
這兩個問題我有此:
- 當測試/調試通過連接到通過USB連接到計算機的手持設備的磨損模擬器,我怎麼能啓動同伴配置活動?在磨損設備上選擇一個表面時,不會出現「齒輪」圖標(但是,我認爲這是因爲沒有可穿戴配置活動,只是伴侶配置活動,但我可能錯了)。
上的Android Wear應用在錶盤上三個點子內的手持設備中是否有「安裝設置應用程序」,但是這個選項只是啓動Play商店和,自然也找不到任何設置的菜單項應用程序來安裝。如何在手持設備上啓動設置/配套活動?
- 如何在我的實際設備上測試/調試這些模塊?我只想通過Android Studio將手持設備模塊加載到我的手機設備上,並將可穿戴模塊加載到連接的磨損設備上。什麼是適當的步驟來實現這一點,因爲我似乎無法做到這一點?
我假設我選擇手持模塊活動,然後運行。在設備選擇器中,我選擇了連接的手持設備,一切似乎都運行完畢,但在設備上或實體磨損設備上的Android Wear應用程序內沒有顯示任何表面。
**** **** UPDATE
我似乎能夠運行同伴配置細當我加載該應用到通過藍牙連接調試
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
還有一個實際可穿戴設備不通過仿真器(如果可能的話)
作爲參考,這裏是清單文件。爲了保護這個項目,我已經清理了一些數據,但沒有任何後果應該丟失。
耐磨清單:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.FOOBAR.android.FOOBAR" >
<uses-feature android:name="android.hardware.type.watch" />
<!-- Required to act as a custom watch face. -->
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.DeviceDefault" >
<service
android:name=".WatchfaceService"
android:label="@string/my_analog_name"
android:permission="android.permission.BIND_WALLPAPER" >
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/preview_accuweather" />
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="@drawable/preview_accuweather" />
<meta-data
android:name="com.google.android.wearable.watchface.companionConfigurationAction"
android:value="com.FOOBAR.android.FOOBAR.watchface.CONFIG_HANDHELD" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
手持清單:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.FOOBAR.android.FOOBAR" >
<uses-sdk android:minSdkVersion="18"
android:targetSdkVersion="21" />
<!-- Permissions required by the wearable app -->
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- All intent-filters for config actions must include the categories
com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION and
android.intent.category.DEFAULT. -->
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".HandheldConfig"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.FOOBAR.android.FOOBAR.watchface.CONFIG_HANDHELD" />
<category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!--
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
-->
</application>
</manifest>
謝謝,但你的答案真的不正確或適用。我可以將我連接USB的手機與我的模擬器配對,而不會出現任何問題。這不是問題。另外,我可以毫無問題地將Wear應用程序安裝到仿真器上。我沒有任何問題在模擬器本身上運行實際的錶盤。 – cpjolicoeur