【问题标题】:Android Wear: Not sync my app to Watch. Why?Android Wear:不将我的应用同步到 Watch。为什么?
【发布时间】:2015-12-07 14:43:35
【问题描述】:

我发布了一个安卓穿戴应用。我在 Google Play 上安装了该应用,并尝试通过 Google Android Wear 应用与我的 Android Wear 同步,但没有成功。

我猜我安装的 apk 不包括“WEAR.apk”。我怎样才能包含它?

当我在 Android Studio 上生成 apk 时,生成了两个 apk。我只上传了一个 apk “APPLICATION.apk”。我预计“APPLICATION.apk”包括“WEAR.apk”。

build.gradle 有 WEAR 的依赖。

wearApp project(':wear')

有没有人知道任何可能的原因和解决方案。

我们将不胜感激。

谢谢,

[更新1]

・应用模块

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.hogehoge.bip" >

    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.autofocus" />

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

    <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >

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

        <activity
                android:name="com.hogehoge.bip.MainActivity"
                android:label="@string/app_name"
                android:screenOrientation="landscape"
                android:launchMode="singleTask" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 18
    buildToolsVersion '20'

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 19
        versionCode 2
        versionName "0.1"
    }

    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.google.android.gms:play-services:5.0.+@aar'
    compile 'com.android.support:support-v4:20.0.+'
    wearApp project(':Wearable')
    compile files('libs/core-2.2.jar')
    compile files('libs/javase-2.2.jar')
    compile files('libs/android-async-http-1.4.5.jar')
}

・可穿戴模块

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.hogehoge.bip" >

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

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

    <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.DeviceDefault">

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

        <service
                android:name="com.hogehoge.bip.DataLayerListenerService" >
            <intent-filter>
                <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
            </intent-filter>
        </service>

        <activity
            android:name="com.hogehoge.bip.PagerActivity"
            android:screenOrientation="portrait"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

build.gradle

apply plugin: 'android'

android {
    compileSdkVersion 20
    buildToolsVersion '20'

    defaultConfig {
        minSdkVersion 20
        targetSdkVersion 20
        versionCode 2
        versionName "0.1"
    }

    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.google.android.gms:play-services-wearable:+'
    compile files('libs/internal_impl-20.0.0.jar')
    compile files('libs/classes.jar')
}

[更新2]

我的应用程序是免费的。非付费应用。

我生成了以下 apk; Application-release.apk(3M) 和 Wearable-release.apk(1.1M)。

[更新3]

我注意到已经发布了类似的问题。

Android Wear generate two apk

根据帖子,我可能不得不使用“释放键”。我正在检查它。

[更新4]

我解压了我在 Google Play 上发布的 apk。结果,我在handledapp.apk里面找到了wearable.apk。

我不知道下一步该怎么做。你能帮帮我吗!

[已解决更新5]

我关注了@Gabriele Mariotti 的提及。然后就可以了!

检查您的权限。智能手机部分需要具备所有 Wear 组件拥有的权限。

为两个应用(穿戴式应用和移动应用)使用相同的包 ID

Android Wear App not installed

【问题讨论】:

    标签: android wear-os


    【解决方案1】:

    如果这是一个付费应用,你不能使用

    wearApp project(':wear')
    

    你必须do it manually

    如果它不是付费应用(如果它是免费的),“APPLICATION.apk”的文件大小是否符合您的预期? (即wear.apk + mobile.apk)

    同时发布您的清单和 build.gradle 文件。

    【讨论】:

    • 感谢您的评论。我的应用程序是免费的,我附上了清单和 build.gradle。我会很感激你能看到它!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-01
    • 1970-01-01
    相关资源
    最近更新 更多