Android Wear project with several taste options

Problem

We ran into a problem with a project that has several (2) sizes of product taste and a wear module. When creating a release, we don’t get compilation errors, and the phone app works, but the wearer app never syncs to watch.

Code example

The telephone module of the application build.gradlecontains (example and extract only)

flavorDimensions 'brand', 'type'

productFlavors {
    nikon {
        dimension 'brand'
    }
    canon {
        dimension 'brand'
    }
    compact {
        dimension 'type'
    }
    slr {
        dimension 'type'
    }
}

dependencies {
    wearApp project(':wear')
}

The app app app module build.gradlecontains the same configuration configuration.

publishNonDefault true

flavorDimensions 'brand', 'type'

productFlavors {
    nikon {
        dimension 'brand'
    }
    canon {
        dimension 'brand'
    }
    compact {
        dimension 'type'
    }
    slr {
        dimension 'type'
    }
}

dependencies {

}

What have we done

We checked whether there is a wear application in apk by installing on the phone and activating the option to synchronize applications for wearing from the official Android application. In the magazine you will get an overview packageIdthat syncs to view:

I/WearablePkgInstaller: Setting DataItem to install wearable apps for your.package.id.here

.

nikonCompactWearApp compile(path:':wear', configuration:'nikonCompactRelease')

. , , , .

nikonWearApp compile(path:':wear', configuration:'nikonCompactRelease')

, , . apk, :

  • .
  • .
  • , .
  • publishNonDefault true
+4

Source: https://habr.com/ru/post/1627128/


All Articles