- Replace
implementation("androidx.wear.tiles:tiles-material:<version>")
withimplementation("androidx.wear.protolayout:protolayout-material:1.0.0-rc01")
- Add
implementation("androidx.wear.protolayout:protolayout-expression:1.0.0-rc01")
andimplementation("androidx.wear.protolayout:protolayout:1.0.0-rc01")
- Update tiles:tiles dependency to use the latest version
implementation("androidx.wear.tiles:tiles:1.2.0-rc01")
, and it should stay for tiles only classes.
Use the script we provided to update your project's imports from Tiles to ProtoLayout. Script can be found here or copy the snippet below:
# Rename material packages
find . -type f -name "*.(java|kt)" -exec sed -i "s|androidx.wear.tiles.material|androidx.wear.protolayout.material|g" {} +
# Rename builder packages
find . -type f -name "*.(java|kt)" -exec sed -i "s|androidx.wear.tiles|androidx.wear.protolayout|g" {} +
# Re-rename real tiles classes
find . -type f -name "*.(java|kt)" -exec sed -i "s|androidx.wear.protolayout.EventBuilders|androidx.wear.tiles.EventBuilders|g" {} +
find . -type f -name "*.(java|kt)" -exec sed -i "s|androidx.wear.protolayout.RequestBuilders|androidx.wear.tiles.RequestBuilders|g" {} +
find . -type f -name "*.(java|kt)" -exec sed -i "s|androidx.wear.protolayout.TileBuilders|androidx.wear.tiles.TileBuilders|g" {} +
find . -type f -name "*.(java|kt)" -exec sed -i "s|androidx.wear.protolayout.TileService|androidx.wear.tiles.TileService|g" {} +
# Rename updated methods
# Note that etXXXX is intentional as there are both setter and getter.
find . -type f -name "*.(java|kt)" -exec sed -i "s|etTimeline|etTileTimeline|g" {} +
find . -type f -name "*.(java|kt)" -exec sed -i "s|onResourcesRequest|onTileResourcesRequest|g" {} +
find . -type f -name "*.(java|kt)" -exec sed -i "s|etDeviceParameters|etDeviceConfiguration|g" {} +
find . -type f -name "*.(java|kt)" -exec sed -i "s|etState|etCurrentState|g" {} +
Alternatively, follow the steps explained here for manual rename.