1

With the following Gradle files of my three modules (common, mobile, and wear), I was wondering why my wearable app doesn't install on the wearable device when I run the mobile app with both the wear virtual emulator and my mobile device running and connected (through USB and the Android wear app), and signed both apks through the mobile module (currently in the mobile directory):

Common module:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

Mobile module:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "dpark.gameoflife"
        minSdkVersion 9
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    signingConfigs {
        debug {
            storeFile file("C:\\Users\\Dave\\AndroidStudioProjects\\KEY_STORE\\Game_of_Life.jks")
            storePassword "***"
            keyAlias "game_of_life"
            keyPassword "***"
        }
        release {
            storeFile file("C:\\Users\\Dave\\AndroidStudioProjects\\KEY_STORE\\Game_of_Life.jks")
            storePassword "***"
            keyAlias "game_of_life"
            keyPassword "***"
        }
    }

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    wearApp project(':wear')
    compile project(':common')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.google.android.gms:play-services-wearable:8.4.0'
}

Wear module:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "dpark.gameoflife"
        minSdkVersion 22
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

    signingConfigs {
        debug {
            storeFile file("C:\\Users\\Dave\\AndroidStudioProjects\\KEY_STORE\\Game_of_Life.jks")
            storePassword "***"
            keyAlias "game_of_life"
            keyPassword "***"
        }
        release {
            storeFile file("C:\\Users\\Dave\\AndroidStudioProjects\\KEY_STORE\\Game_of_Life.jks")
            storePassword "***"
            keyAlias "game_of_life"
            keyPassword "***"
        }
    }

    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.3.0'
    compile 'com.google.android.gms:play-services-wearable:8.4.0'
    compile project(':common')
}

Common manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    package="dpark.common" >
</manifest>

Mobile manifest:

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme.NoActionBar" >
        <activity
            android:name=".MainActivity">
        </activity>
        <activity
            android:name=".WelcomeActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

Wear manifest:

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

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
        </activity>
        <activity
            android:name=".WelcomeActivity"
            android:theme="@android:style/Theme.DeviceDefault" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

... While the app properly installs on my mobile device, I only get a notification (at most when my sample app is simply supposed to display a GridView) on my wear virtual emulator as follows:

enter image description here

enter image description here

enter image description here

Thanks!

EDIT AS OF 4/4: -Here's what I get on my logcat:

04-04 09:39:27.462 15810-15810/dpark.gameoflife I/art: Late-enabling -Xcheck:jni
04-04 09:39:27.462 15810-15810/dpark.gameoflife I/art: VMHOOK: rlim_cur : 0 pid:15810
04-04 09:39:27.543 15810-15810/dpark.gameoflife W/System: ClassLoader referenced unknown path: /data/app/dpark.gameoflife-1/lib/arm
04-04 09:39:27.570 15810-15810/dpark.gameoflife I/GMPM: App measurement is starting up, version: 8487
04-04 09:39:27.571 15810-15810/dpark.gameoflife I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE
04-04 09:39:27.580 15810-15810/dpark.gameoflife E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services.  Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin.
04-04 09:39:27.580 15810-15810/dpark.gameoflife E/GMPM: Scheduler not set. Not logging error/warn.
04-04 09:39:27.644 15810-15831/dpark.gameoflife E/GMPM: Uploading is not possible. App measurement disabled
04-04 09:39:27.763 15810-15847/dpark.gameoflife I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8974_LA.BF.1.1.3__release_AU (I3fa967cfef)
04-04 09:39:27.763 15810-15847/dpark.gameoflife I/Adreno-EGL: OpenGL ES Shader Compiler Version: E031.28.00.02
04-04 09:39:27.763 15810-15847/dpark.gameoflife I/Adreno-EGL: Build Date: 09/29/15 Tue
04-04 09:39:27.763 15810-15847/dpark.gameoflife I/Adreno-EGL: Local Branch: mybranch14683032
04-04 09:39:27.763 15810-15847/dpark.gameoflife I/Adreno-EGL: Remote Branch: quic/master
04-04 09:39:27.763 15810-15847/dpark.gameoflife I/Adreno-EGL: Local Patches: NONE
04-04 09:39:27.763 15810-15847/dpark.gameoflife I/Adreno-EGL: Reconstruct Branch: NOTHING
04-04 09:39:37.863 15810-15831/dpark.gameoflife I/GMPM: Tag Manager is not found and thus will not be used
04-04 09:43:06.197 15810-15847/dpark.gameoflife E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb9d385f0

... Am I missing something either in my Manifest or Gradle files as shown above in this post?

DaveNOTDavid
  • 1,753
  • 5
  • 19
  • 37
  • follow the steps on this answer and report back http://stackoverflow.com/questions/25004530/android-wear-app-not-installing-through-handset – camlunt Mar 28 '16 at 18:22
  • Still, no hope :( I included signed configs in both mobile and wear Gradle files, but yet I only get notifications as shown above in my edited post... – DaveNOTDavid Mar 29 '16 at 15:26
  • Is your app the Threat Scan that you posted the notification from? – Sterling Mar 29 '16 at 16:30
  • Nope, it's just a sample app consisting of only a GridView; no notifications nor permissions as shown in my post – DaveNOTDavid Mar 30 '16 at 12:04
  • @String any ideas? :( – DaveNOTDavid Mar 31 '16 at 13:18
  • I asked about Threat Scan because that's the notification you posted; it wasn't clear which was your app. But it sounds like that notification's not relevant to your issue. Otherwise, I agree with camlunt's comment; follow all the steps in all the answers at the linked question. It's impossible to tell here which step you've gotten wrong. I would also say you should look at logcat on the watch for a few minutes after you've installed your handheld app (filtered on your package name); often there's an indication there when the installation goes awry. – Sterling Apr 02 '16 at 15:12
  • @String Ok, so after signing an apk release version of the mobile module (with wear embedded), connecting to the wear virtual emulator through the Android Wear app on my mobile device with the USB connected, running my app onto my mobile device, and even giving a few minutes of seeing what happens on my logcat just as you suggested, I get outputs as shown above in my edited post... Any idea what it means? I appreciate the help btw – DaveNOTDavid Apr 04 '16 at 14:16

1 Answers1

0

First impressions

Could be many things wrong here. On first sight the gradle configurations seem fine having a wear app reference, matching version name and numbers, application Id and package names. The manifests don't show permissions that could be missing. No special flavors.

What you really need to do -> get LOGS

In order to resolve this issue you need to collect logs. I see you have logcat output but that is really just from your app. You need to filter on android wear package installer specific stuff with a filter set on WearablePkgInstaller.

Also from the logging on your handheld device you will only see an instruction to trigger the installation. That should show every time you reinstall your app or trigger app sync from the wear OS app.

11-07 14:58:53.127 3330-8739/? I/WearablePkgInstaller: Setting DataItem to install wearable apps for com.spotify.music

The really valuable logging however is on the watch. So make sure to get logging from the wearable device. There you will get information, including the reason why, on the failed installation.

Some watches have a USB connection for debugging. Others require some extra steps to enable debugging over bluetooth. First step is to enable developer options and debugging by tapping the build number several times, similar to how it's done on the handheld.

The logging on the wearable can be filtered on that same WearablePkgInstaller filter or you could use your own package Id to filter on. The logging can be very clear (like mismatching google play services or missing permissions) or rather cryptical with a returnCode.

In case of the returnCode you'll have to check in source code of Android what that code stands for and based on the javadoc you can start searching more specifically.

Some more things you could check

Wearable projects are only included in release builds. Also the latest Android studio builds have a flag set (FLAG_TEST_ONLY) that would result in a failure with returnCode -15 upon installation. Check that the handheld app has the proper runtime permissions enabled (that should be clear from error logging also).

Even build tools for optimalisation could remove the wear project from the app. And then there is the option that either wearable or handheld doesn't have the latest Google Play Services. Make sure to also check the accepted answer on this SO question for options.

Community
  • 1
  • 1
hcpl
  • 17,382
  • 7
  • 72
  • 73