As of version 1.2, most Tiles layout APIs are in the androidx.wear.protolayout
namespace. To use the latest APIs, complete the following migration steps in
your code.
Update dependencies
In your app module's build file, make the following changes:
// Removeimplementation 'androidx.wear.tiles:tiles-material:// Include additional dependencies implementation "androidx.wear.protolayout:protolayout:1.2.1" implementation "androidx.wear.protolayout:protolayout-material:1.2.1" implementation "androidx.wear.protolayout:protolayout-expression:1.2.1" // Update implementation "androidx.wear.tiles:tiles:1.4.1"version '
// Removeimplementation("androidx.wear.tiles:tiles-material:// Include additional dependencies implementation("androidx.wear.protolayout:protolayout:1.2.1") implementation("androidx.wear.protolayout:protolayout-material:1.2.1") implementation("androidx.wear.protolayout:protolayout-expression:1.2.1") // Update implementation("androidx.wear.tiles:tiles:1.4.1")version ")
Update namespaces
In your app's Kotlin- and Java-based code files, make the following updates. Alternatively, you can execute this namespace renaming script.
- Replace all
androidx.wear.tiles.material.*
imports withandroidx.wear.protolayout.material.*
. Complete this step for theandroidx.wear.tiles.material.layouts
library, too. Replace most other
androidx.wear.tiles.*
imports withandroidx.wear.protolayout.*
.Imports for
androidx.wear.tiles.EventBuilders
,androidx.wear.tiles.RequestBuilders
,androidx.wear.tiles.TileBuilders
, andandroidx.wear.tiles.TileService
should stay the same.Rename a few deprecated methods from TileService and TileBuilder classes:
TileBuilders
:getTimeline()
togetTileTimeline()
, andsetTimeline()
tosetTileTimeline()
TileService
:onResourcesRequest()
toonTileResourcesRequest()
RequestBuilders.TileRequest
:getDeviceParameters()
togetDeviceConfiguration()
,setDeviceParameters()
tosetDeviceConfiguration()
,getState()
togetCurrentState()
, andsetState()
tosetCurrentState()
No recommendations at this time.
Try signing in to your Google account.