0

My project was working fine when I had just a simple handheld app with one wear app.

Now, I've introduced three flavors to the handheld app and kept the same single flavor wear app.

The problem is that release builds are not being pushed to the wearable.

My project looks like this:

smartphone's build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 8
        versionName "3.1.0"
        applicationId "br.com.test"
    }

    signingConfigs {
        ...
    }

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

        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
            zipAlignEnabled true
        }
    }

    productFlavors {
        generic {
            applicationId "br.com.generic"
        }
        abc {
            applicationId "br.com.teste.abc"
        }
        company {
            applicationId "br.com.test.company"
        }
    }
}

dependencies {
    genericWearApp project(path:':wear', configuration: 'genericRelease')
    abcWearApp project(path:':wear', configuration: 'abcRelease')
    companyWearApp project(path:':wear', configuration: 'companyRelease')

    compile project(':common')
}

and wear's build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    publishNonDefault true

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 8
        versionName "3.1.0"
        applicationId "br.com.test"
    }

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

        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
            zipAlignEnabled true
        }
    }

    productFlavors {
        generic {
            applicationId "br.com.generic"
        }
        abc {
            applicationId "br.com.teste.abc"
        }
        company {
            applicationId "br.com.test.company"
        }
    }
}

dependencies {
    compile project(':common')
}

Why does the wearable does not gets the app? Any tips?

MatheusJardimB
  • 3,599
  • 7
  • 46
  • 70
  • What variant do you have selected in Android Studio? (View menu -> Tool Windows -> Build Variants). It'll show you both modules and the currently selected variant for each one. Make sure variant is selected for the module that reflects the build type and product flavor combination, e.g. genericRelease you want to run. – brindy Jan 15 '16 at 23:24
  • I'm running in the console 'gradle clean assembleGenericRelease assembleAbcRelease ...'. – MatheusJardimB Jan 15 '16 at 23:37
  • you need to use "installGenericRelease" to push it to the device – brindy Jan 15 '16 at 23:53
  • hmm, I just recreated your set up and ran ./gradlew tasks - the install tasks are not available for the release variants, it seems. – brindy Jan 15 '16 at 23:54
  • I can run adb install to get the app running into the smartphone but I expect to automatically push it to the wearable too – MatheusJardimB Jan 15 '16 at 23:56
  • This seems related - does your mobile app have a dependency on your wear app? http://stackoverflow.com/a/29040088/73479 – brindy Jan 16 '16 at 00:00
  • Nope. Both apps depend in a commons lib. – MatheusJardimB Jan 16 '16 at 00:01
  • That should be fine, but if I'm reading the above correctly I think you need the 'wearApp project(':wear')' in your app's dependencies. – brindy Jan 16 '16 at 00:05

1 Answers1

1

I was only a matter of tricky details... This repo offers a really nice example and was enough to help me solve this:

https://github.com/vngrs/PomoPomoAndroid/

MatheusJardimB
  • 3,599
  • 7
  • 46
  • 70