ProtoLayout नेमस्पेस पर माइग्रेट करें

वर्शन 1.2 के बाद से, टाइल लेआउट के ज़्यादातर एपीआई androidx.wear.protolayout में मौजूद हैं नेमस्पेस. एपीआई के नए वर्शन का इस्तेमाल करने के लिए, माइग्रेशन के इन चरणों को पूरा करें आपका कोड.

डिपेंडेंसी अपडेट करें

अपने ऐप्लिकेशन मॉड्यूल की बिल्ड फ़ाइल में, ये बदलाव करें:

ग्रूवी

  // Remove
  implementation 'androidx.wear.tiles:tiles-material:version'

  // Include additional dependencies
  implementation "androidx.wear.protolayout:protolayout:1.2.0-rc01"
  implementation "androidx.wear.protolayout:protolayout-material:1.2.0-rc01"
  implementation "androidx.wear.protolayout:protolayout-expression:1.2.0-rc01"

  // Update
  implementation "androidx.wear.tiles:tiles:1.4.0-rc01"

Kotlin

  // Remove
  implementation("androidx.wear.tiles:tiles-material:version")

  // Include additional dependencies
  implementation("androidx.wear.protolayout:protolayout:1.2.0-rc01")
  implementation("androidx.wear.protolayout:protolayout-material:1.2.0-rc01")
  implementation("androidx.wear.protolayout:protolayout-expression:1.2.0-rc01")

  // Update
  implementation("androidx.wear.tiles:tiles:1.4.0-rc01")

नेमस्पेस अपडेट करें

अपने ऐप्लिकेशन की Kotlin- और Java पर आधारित कोड फ़ाइलों में, ये अपडेट करें. इसके अलावा, नेमस्पेस का नाम बदलने वाली स्क्रिप्ट को भी एक्ज़ीक्यूट किया जा सकता है.

  1. सभी androidx.wear.tiles.material.* इंपोर्ट को इससे बदलें androidx.wear.protolayout.material.*. इसके लिए यह चरण पूरा करें: androidx.wear.tiles.material.layouts लाइब्रेरी भी.
  2. ज़्यादातर अन्य androidx.wear.tiles.* इंपोर्ट को इससे बदलें androidx.wear.protolayout.*.

    androidx.wear.tiles.EventBuilders के लिए इंपोर्ट, androidx.wear.tiles.RequestBuilders, androidx.wear.tiles.TileBuilders, और androidx.wear.tiles.TileService में कोई बदलाव नहीं होना चाहिए.

  3. TileService और TileBuilder क्लास से, काम न करने वाले कुछ तरीकों के नाम बदलें:

    1. TileBuilders: getTimeline() से getTileTimeline() तक और setTimeline() से setTileTimeline()
    2. TileService: onResourcesRequest() से onTileResourcesRequest() तक
    3. RequestBuilders.TileRequest: getDeviceParameters() से getDeviceConfiguration(), setDeviceParameters() से setDeviceConfiguration(), getState() से getCurrentState(), और setState() से setCurrentState()
{% endverba नया %} {% verbatim %}