バージョン 1.2 ではタイル レイアウト API のほとんどは androidx.wear.protolayout
名前空間にあります。最新の API を使用するには、コードで以下の移行手順を実行してください。
依存関係を更新する
アプリ モジュールのビルドファイルを次のように変更します。
// Remove
implementation 'androidx.wear.tiles:tiles-material:version '
// Include additional dependencies
implementation "androidx.wear.protolayout:protolayout:1.3.0-alpha03"
implementation "androidx.wear.protolayout:protolayout-material:1.3.0-alpha03"
implementation "androidx.wear.protolayout:protolayout-expression:1.3.0-alpha03"
// Update
implementation "androidx.wear.tiles:tiles:1.5.0-alpha03"
// Remove
implementation("androidx.wear.tiles:tiles-material:version ")
// Include additional dependencies
implementation("androidx.wear.protolayout:protolayout:1.3.0-alpha03")
implementation("androidx.wear.protolayout:protolayout-material:1.3.0-alpha03")
implementation("androidx.wear.protolayout:protolayout-expression:1.3.0-alpha03")
// Update
implementation("androidx.wear.tiles:tiles:1.5.0-alpha03")
名前空間を更新する
アプリの Kotlin ベースと Java ベースのコードファイルを次のように更新します。または、こちらの名前空間名変更スクリプトを実行することもできます。
- すべての
androidx.wear.tiles.material.*
インポートをandroidx.wear.protolayout.material.*
に置き換えます。androidx.wear.tiles.material.layouts
ライブラリでもこのステップを実行します。 他の
androidx.wear.tiles.*
インポートのほとんどをandroidx.wear.protolayout.*
に置き換えます。androidx.wear.tiles.EventBuilders
、androidx.wear.tiles.RequestBuilders
、androidx.wear.tiles.TileBuilders
、androidx.wear.tiles.TileService
のインポートはそのままにします。TileService クラスと TileBuilder クラスの非推奨のメソッドの名前を変更します。
TileBuilders
:getTimeline()
からgetTileTimeline()
、setTimeline()
からsetTileTimeline()
に変更TileService
:onResourcesRequest()
からonTileResourcesRequest()
に変更RequestBuilders.TileRequest
:getDeviceParameters()
からgetDeviceConfiguration()
、setDeviceParameters()
からsetDeviceConfiguration()
、getState()
からgetCurrentState()
、setState()
からsetCurrentState()
に変更
現在、おすすめはありません。
Google アカウントにログインしてください。