2017-08-07 225 views
0

我正在尝试为1.x和2安装独立的Android Wear应用。我遵循了步骤on the android developer page,但用户说安装apk不会自动安装他们的1.x手表。移动应用拥有相同的权限。这只是在这里获得穿apk安装。移动应用上没有任何活动。为Android安装1.x和2.0包装分开安装apk

我是否需要将磨损应用程序打包到我的移动应用程序中?从我读到的内容来看,即使对于1.x也不应该这样做。

这里是什么我的APK看起来像在开发者控制台预览: enter image description here

手机清单:

<?xml version="1.0" encoding="utf-8"?> 

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 
<uses-permission android:name="android.permission.WAKE_LOCK" /> 
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> 
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:roundIcon="@mipmap/ic_launcher" 
    android:supportsRtl="true" 
    android:theme="@style/Theme.Nav"> 

</application> 

磨损清单:

<?xml version="1.0" encoding="utf-8"?> 

<uses-feature android:name="android.hardware.type.watch" /> 

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> 
<uses-permission android:name="android.permission.WAKE_LOCK" /> 
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> 
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" /> 

<!-- Required for complications to receive complication data and open the provider chooser. --> 
<uses-permission android:name="com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA"/> 

<application 
    android:name=".App" 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:roundIcon="@mipmap/ic_launcher" 
    android:supportsRtl="true" 
    android:theme="@style/Theme.Nav"> 
    <uses-library 
     android:name="com.google.android.wearable" 
     android:required="false" /> 

    <meta-data 
     android:name="com.google.android.wearable.standalone" 
     android:value="true" /> 

    <activity android:name=".ui.activity.SplashActivity" 
     android:label="@string/app_name" 
     android:theme="@android:style/Theme.Translucent.NoTitleBar"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

    <!-- Main activity for music browsing on phone --> 
    <activity android:name=".ui.activity.MainActivity" 
     android:launchMode = "singleTop"> 
    </activity> 

    <service android:name=".service.MediaPlayerService" /> 

    <activity android:name="android.support.wearable.activity.ConfirmationActivity" /> 

    <!-- 
    Main music service, provides media browsing and media playback services to 
    consumers through MediaBrowserService and MediaSession. Consumers connect to it through 
    MediaBrowser (for browsing) and MediaController (for play session control) 
    --> 

    <service android:name=".service.FsService" /> 
    <service android:name=".service.NsdService" /> 

    <receiver 
     android:name=".service.NsdService$StartStopReceiver" 
     android:exported="false"> 
     <intent-filter> 
      <action android:name="com.turndapage.navmusic.FTPSERVER_STARTED" /> 
      <action android:name="com.turndapage.navmusic.FTPSERVER_STOPPED" /> 
     </intent-filter> 
    </receiver> 

    <!-- Don't export this receiver in free, this clashes with paid --> 
    <receiver 
     android:name=".RequestStartStopReceiver" 
     android:exported="true"> 
     <intent-filter> 
      <action android:name="com.turndapage.navmusic.ACTION_START_FTPSERVER" /> 
      <action android:name="com.turndapage.navmusic.ACTION_STOP_FTPSERVER" /> 
     </intent-filter> 
    </receiver> 
    <receiver android:name=".WifiStateChangeReceiver"> 
     <intent-filter> 
      <action android:name="android.net.wifi.STATE_CHANGE" /> 
     </intent-filter> 
    </receiver> 

    <service android:name=".WifiStateChangeReceiver$StartServerService" /> 
    <service android:name=".WifiStateChangeReceiver$StopServerService" /> 

    <meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version" /> 

    <service 
     android:name=".watchface.AnalogComplicationWatchFaceService" 
     android:enabled="true" 
     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_analog" /> 
     <meta-data 
      android:name="com.google.android.wearable.watchface.preview_circular" 
      android:resource="@drawable/preview_analog" /> 
     <meta-data 
      android:name="com.google.android.wearable.watchface.wearableConfigurationAction" 
      android:value="com.turndapage.navmusic.CONFIG_COMPLICATION_SIMPLE"/> 

     <intent-filter> 
      <action android:name="android.service.wallpaper.WallpaperService" /> 

      <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> 
     </intent-filter> 
    </service> 

    <activity android:name="android.support.wearable.complications.ComplicationHelperActivity"/> 
    <activity 
     android:name=".config.AnalogComplicationConfigActivity" 
     android:label="@string/analog_complication_config"> 
     <intent-filter> 
      <action android:name="com.turndapage.navmusic.CONFIG_COMPLICATION_SIMPLE"/> 

      <category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION"/> 
      <category android:name="android.intent.category.DEFAULT"/> 
     </intent-filter> 
    </activity> 

    <receiver android:name=".provider.ComplicationToggleReceiver"/> 

    <activity android:name=".config.ColorSelectionActivity"/> 

    <service android:name=".provider.CurrentSongComplicationProvider" 
     android:icon="@drawable/ic_library_music_white_24dp" 
     android:label="@string/current_song" 
     android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> 
     <intent-filter> 
      <action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/> 
     </intent-filter> 

     <meta-data 
      android:name="android.support.wearable.complications.SUPPORTED_TYPES" 
      android:value="SHORT_TEXT,LONG_TEXT"/> 

     <meta-data 
      android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" 
      android:value="0"/> 
    </service> 

    <service android:name=".provider.SkipBackComplicationProvider" 
     android:icon="@drawable/ic_skip_previous_white_24dp" 
     android:label="@string/skip_back" 
     android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> 
     <intent-filter> 
      <action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/> 
     </intent-filter> 

     <meta-data 
      android:name="android.support.wearable.complications.SUPPORTED_TYPES" 
      android:value="ICON"/> 

     <meta-data 
      android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" 
      android:value="0"/> 
    </service> 

    <service android:name=".provider.SkipForwardComplicationProvider" 
     android:icon="@drawable/ic_skip_next_white_24dp" 
     android:label="@string/skip_next" 
     android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> 
     <intent-filter> 
      <action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/> 
     </intent-filter> 

     <meta-data 
      android:name="android.support.wearable.complications.SUPPORTED_TYPES" 
      android:value="ICON"/> 

     <meta-data 
      android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" 
      android:value="0"/> 
    </service> 

    <service android:name=".provider.PlayPauseComplicationProvider" 
     android:icon="@drawable/ic_media_play_dark" 
     android:label="@string/play_pause" 
     android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> 
     <intent-filter> 
      <action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/> 
     </intent-filter> 

     <meta-data 
      android:name="android.support.wearable.complications.SUPPORTED_TYPES" 
      android:value="ICON"/> 

     <meta-data 
      android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" 
      android:value="0"/> 
    </service> 

    <!-- Watch face stuff --> 

</application> 

移动摇篮:

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 26 
buildToolsVersion "26.0.1" 
defaultConfig { 
    applicationId "com.turndapage.navmusic" 
    minSdkVersion 15 
    targetSdkVersion 26 
    versionCode 260350011 
    versionName "0.3.5" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    wearAppUnbundled true 
} 
buildTypes { 
    release { 
     minifyEnabled true 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

repositories { 
jcenter() 
maven { 
    url 'https://maven.google.com' 
} 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{ 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:26.0.1' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
testCompile 'junit:junit:4.12' 
} 

的gradle磨损:

plugins { 
id "me.tatarka.retrolambda" version "3.5.0" 
} 
apply plugin: 'com.android.application' 

android { 
compileSdkVersion 26 
buildToolsVersion "26.0.1" 
defaultConfig { 
    applicationId "com.turndapage.navmusic" 
    minSdkVersion 23 
    targetSdkVersion 26 
    versionCode 260350010 
    versionName "0.3.5" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
// Needed for retrolambda 
compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_8 
    targetCompatibility JavaVersion.VERSION_1_8 
} 
} 

repositories { 
jcenter() 
maven { 
    url 'https://maven.google.com' 
} 
} 

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'com.google.android.support:wearable:2.0.3' 
compile 'com.android.support:wear:26.0.1' 
compile 'com.google.android.gms:play-services-wearable:11.0.4' 
compile 'com.google.android.exoplayer:exoplayer:r2.4.1' 
compile 'de.hdodenhof:circleimageview:1.3.0' 
compile 'com.google.code.gson:gson:2.7' 
compile 'com.github.kabouzeid:app-theme-helper:1.3.7' 
compile 'com.android.support:support-v4:26.0.1' 
compile 'com.android.support:design:26.0.1' 
compile 'com.android.support:appcompat-v7:26.0.1' 
compile 'com.android.support:preference-v7:26.0.1' 
compile 'com.android.support:mediarouter-v7:26.0.1' 
compile 'com.android.support:percent:26.0.1' 
compile 'net.vrallev.android:cat:1.0.5' 
compile 'org.projectlombok:lombok:1.16.18' 
compile 'com.twofortyfouram:android-plugin-client-sdk-for-locale:4.0.2' 
compile 'com.squareup.retrofit2:retrofit:2.3.0' 
compile 'com.squareup.retrofit2:converter-gson:2.3.0' 
compile 'com.github.bumptech.glide:glide:4.0.0-RC1' 
compile 'com.google.android.gms:play-services-fitness:11.0.4' 
compile 'com.android.support:palette-v7:26.0.1' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1' 
provided 'com.google.android.wearable:wearable:2.0.3' 
} 

[编辑]我不得不更新包括并发症permissio并在移动应用程序中删除手表功能以将其上传到游戏商店。一些用户报告说正在安装,但其他用户无法使用它。

回答

1

你的假设是正确的,你不应该在手机APK中嵌入穿APK(这是​​做旧的方式)。但是,您仍然需要发布手机APK。

您的屏幕截图中只有2个APK。总共应该有3个:电话APK for AW 1.x,穿APK for AW 1.x,穿AW APK的APK。

确保AW 2.0 APK的版本号码最高,其次是AW 1.x手表APK,最后是AW 1.x手机APK。

请注意,只有先前发布带嵌入式穿戴APK的AW 1.x应用程序时,才需要标记wearAppUnbundled true(在您的手机gradle文件中)(但不应伤害否则将其包括在内)。

+0

从阅读文档中,我认为只有在需要使用sdk 25时才需要使用两个apks。我只需要23.“如果您想要同时定位SDK版本23和版本25,请更新Wear模块的版本。如果现有Wear 1.x应用程序的最低SDK版本为23,则包含以下内容:“是否需要? –

+0

我刚读了三遍,我的回答是:我真的不知道。至少可以说,这有点令人困惑。我所知道的是,上面的作品适合我。但在我的情况下,AW 2.0 APK支持API等级25+,AW 1.x APK(电话和可穿戴设备)支持API等级20+。不知道这是否有所作为。 – TofferJ

+0

刚刚得到我的一位用户的确认,它确实最终与手表同步。这通常很慢,所以可能只是等待一段时间。我很欣赏这个确认。我会尝试更新,一旦我发现它是否适用于Android 2.0用户。 –