【问题标题】:Google console showing 0 supported devices for android wearGoogle 控制台显示 0 个支持的 Android Wear 设备
【发布时间】:2015-07-07 19:39:08
【问题描述】:

当我尝试在 Google Play 开发者控制台中上传我的 APK 时,它给了我 0 个受支持的设备。此应用程序是为安卓穿戴而开发的。我试图查看清单文件,但没有发现任何问题。

佩戴 AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.util.uni.student" >

    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="22"
        android:versionCode="1"
        android:versionName="1.0"
        />
    <uses-feature android:name="android.hardware.type.watch" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/st_icon"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault" >
        <activity
            android:name=".studentBroadcastActivity"
            android:label="student" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <receiver
            android:name=".studentReceiver"
            android:exported="true" >
            <intent-filter>
                <action android:name="com.util.uni.student.SHOW_NOTIFICATION" />
            </intent-filter>
        </receiver>
        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    </application>

</manifest>

编辑:

我已经进行了您提到的更改。现在我有两个项目,一个是一个空的移动模块,其中包含我的可穿戴模块的引用。但是,仍然得到 0 兼容设备。

佩戴 Build.Gradle 脚本

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.util.uni.student"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    wearApp project(':wear')
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.google.android.gms:play-services:7.5.0'
}

Mobile Build.Gradle 脚本

apply plugin: 'com.android.application'


android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.util.uni.student"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.support:wearable:1.2.0'
    compile 'com.google.android.gms:play-services:7.5.0'
}

移动 AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.util.uni.student">

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

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application android:allowBackup="true" android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher" android:theme="@style/AppTheme">

    </application>

</manifest>

编辑#2:

我已经更新了移动 AndroidManifest.xml 并从中删除了手表功能。现在,它显示设备,但不显示手表作为设备。

【问题讨论】:

  • 可能所有这些设备都有 android 4.4w。尝试更改 android:minSdkVersion="20"
  • 我已将其更改为 20 和 19,但在这两种情况下均无效。
  • 根据额外的细节更新了我的答案。手表功能只需要包含在磨损清单中。

标签: java android google-play android-manifest wear-os


【解决方案1】:

根据您更新的问题,您的移动清单不需要手表功能。这应该只包含在手表应用中。

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

澄清前的原始答案可能对其他人有所帮助

您不能只将手表应用程序上传到 Play 商店,它需要包含在移动 apk 文件中,即使这只是一个空容器。

您应该有一个包含可穿戴应用程序作为依赖项的移动 build.gradle,我下面的示例引用了一个名为 wear 的单独模块,它是我项目的一部分并包含手表应用程序。

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.google.android.gms:play-services-wearable:7.3.0'
...
}

See official documentation

【讨论】:

  • 你的意思是 ... 所以,是的,我已经删除了它,之后它向我展示了设备,但我的手表不在那里。
  • 您的 Play 商店列表现在是正确的,它只显示您的应用可以在哪些移动设备上运行。将磨损部件视为 Play 商店未提供详细信息的可选附件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-25
  • 1970-01-01
相关资源
最近更新 更多