Material3 へのアップグレードで PullRefresh (SwipeRefresh) ができない件

👉 [Feature Request] PullRefreshIndicator for Material 3 [261760718] - Visible to Public - Issue Tracker hatena-bookmark

2023 年 1 月 17 日 05:01AM

accompanist/swiperefresh が非推奨になったので、M3 に実際の代替機能がないのは迷惑です。

2023年2月11日午後12時07分

こんにちは、機能リクエストありがとうございます! 返信が遅くなり申し訳ございません。現時点では、私たちの主な焦点は、PullRefreshIndicator が含まれていないマテリアル 3 デザイン仕様の内容を構築することです。これを完了した後 (今年中頃を目指しています)、データを調べて M2 PullRefresh の使用方法を学び、M3 ライブラリでのビルドの優先順位を評価します。

2023 年 3 月 21 日 12:34AM

私たちと同じように、これが人々の M2 から M3 への完全な移行を妨げる最後の問題になると思います。

2023 年 5 月 5 日 03:25AM

最新のアップデートはこちら:

M2 の pullrefresh には設計上の重大な問題がいくつかあり、このコンポーネントの M3 実装を提供することを最終的に決定する前に、この問題に対処したいと考えています。この M2 の作業が優先されると、M3 の実装に関するより具体的なタイムラインを提供できるようになります。

2023 年 8 月 8 日 09:38AM

こんにちは、いつ発売されるかについての情報はありますか?

そして現時点では、プルを使用して機能を更新するにはどうすればよいでしょうか?

2023 年 8 月 16 日 03:06AM

PullRefresh は、M2 からの既知の移行ギャップであり、現在開発中です。そのタイムラインについてはまだ正確な見積もりがありませんが、この動作のさまざまなコンポーネントが実装されるにつれて、このバグは更新されるでしょう。

現在、M3 で PullRefresh を使用する最良の方法は、その間に M2 ロジックをフォークすることです。

2023 年 8 月 22 日 09:54AM

この問題がこんなに長く続いていることに本当に驚いています。おそらく M3 はまだ準備ができていないので、アップグレードすべきではありません。

2023 年 8 月 28 日 12:17AM

Material3 にアップグレードしたかったのですが、これによってブロックされました。

2023年9月1日 08:22PM

これは私たちにとっても M3 へのアップグレードを妨げる問題です。

2023年9月23日 02:21AM

[マテリアル3][PullRefresh] PullRefreshIndicatorをM3に更新

* APIはPullRefreshState に依存しないように更新されました
* TonalElevation の動作は M3 に移植されていません
* PullRefreshIndicatorTransformation ロジックはここに移動されました
* 注: PullRefreshIndicator と PullRefreshIndicatorDefaults は、PullRefresh 動作の導入とともにパブリックとしてマークされます。

ということでもう少しかかりそうです。

とりあえず、これ、使ってみますか。

Material3 へのアップグレードで PullRefresh (SwipeRefresh) ができない件

👉 Omico/androidx-compose-material3-pullrefresh: A temporary solution for Jetpack Compose Material 3 pull refresh. hatena-bookmark


Jetpack Compose Dependency versions API-33 vs API-34

 

💻 Dependencies のバージョンがきれいに揃わない

ひとつづつ地道にバージョンを上げていったもののここまでしか上げることができない。

Jetpack Compose Dependency versions API-33 vs API-34

これ以上の安定版バージョンもすでに公開されているのだが、どうしても、

「API-33 ではこのバージョンは使えないので API-34 に上げてください」

というような SDK のバージョンアップを促されるメッセージが表示され、ビルドできない。

👉 Dependency 'androidx.emoji2:emoji2-views-helper:1.4.0' requires version 34 or later [295457468] - Visible to Public - Issue Tracker hatena-bookmark


 

💻 プロの回答

Android 14 の API 34 が完成したことにより、すべての新しい Jetpack ライブラリ リリースが API 34 でコンパイルされ始めました。つまり、アプリも API 34 でコンパイルする必要があります。targetSdk は、多くのことができるまったく異なるものであることに注意してください。


すなわち、


compileSdk 34
targetSdk 33

でビルドせろ。ということなのか。

 

💻 Android Studio Giraffe

現在の Android Studio Giraffe | 2022.3.1 では、最新のサポートする API レベルは「33」。


👉 Android Studio Giraffe | 2022.3.1  |  Android Developers hatena-bookmark

これ、34 に上げてもいいの ?

 

💻 まとめ

Jetpack ライブラリの安定版最新を使いたい場合は、

Android Studio Girrafe でなく、まだ、ベータ版の Hedgehog | 2023.1.1 を使ったほうがいいんでないの?

一見、きれいに通っているように見える。


compileSdk 34
targetSdk 34

それとも、すべて安定版のまま、我慢の開発を続けるか。

👉 JetBrains Toolbox で Android Studio の Stable/Beta/Canary が同時に管理できる? hatena-bookmark


【Android Studio】[File] - [Project Structure] - [Suggestions] で「Update」する dependencies の妥当性 💉

Suggestions に表示されてるので Update する。

androidx.navigation:navigation-compose が 2.7.0-beta02 で NG だが 2.7.0-beta01 で OK な件


androidx.navigation:navigation-compose:2.7.0-beta01

  ↓

androidx.navigation:navigation-compose:2.7.0-beta02

はい、NG です。

androidx.navigation:navigation-compose が 2.7.0-beta02 で NG だが 2.7.0-beta01 で OK な件

なんでや!?

 

💉 エラーメッセージ 「5 issues were found when checking AAR metadata」

エラーメッセージを見てみる。


5 issues were found when checking AAR metadata:


  1.  Dependency 'androidx.navigation:navigation-common:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).


  2.  Dependency 'androidx.navigation:navigation-runtime:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).

  3.  Dependency 'androidx.navigation:navigation-common-ktx:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).

  4.  Dependency 'androidx.navigation:navigation-runtime-ktx:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).

  5.  Dependency 'androidx.navigation:navigation-compose:2.7.0-beta02' requires libraries and applications that
      depend on it to compile against version 34 or later of the
      Android APIs.

      :app is currently compiled against android-33.

      Also, the maximum recommended compile SDK version for Android Gradle
      plugin 8.0.1 is 33.

      Recommended action: Update this project's version of the Android Gradle
      plugin to one that supports 34, then update this project to use
      compileSdk of at least 34.

      Note that updating a library or application's compileSdk (which
      allows newer APIs to be used) can be done separately from updating
      targetSdk (which opts the app in to new runtime behavior) and
      minSdk (which determines which devices the app can be installed
      on).

長いですが要するに、


androidx.navigation:navigation-compose:2.7.0-beta02

が依存している以下、


androidx.navigation:navigation-common:2.7.0-beta02
androidx.navigation:navigation-runtime:2.7.0-beta02
androidx.navigation:navigation-common-ktx:2.7.0-beta02
androidx.navigation:navigation-runtime-ktx:2.7.0-beta02

は、


Android API 34

以上を必要としているので使えません。

ということのよう。

 

💉 なぜ私は、Android API 33 だったけか

「Flamingo」なのでそれが最新安定版。

androidx.navigation:navigation-compose が 2.7.0-beta02 で NG だが 2.7.0-beta01 で OK な件

Android Studio Flamingo | 2022.2.1 を使ってる場合、33 までです。

👉 Android Studio Flamingo | 2022.2.1  |  Android Developers hatena-bookmark

 

💉 まとめ

Android Studio の Suggestion ダイアログ

androidx.navigation:navigation-compose が 2.7.0-beta02 で NG だが 2.7.0-beta01 で OK な件


[File]

  |

[Project Structue]

  |

[Suggestions]

は、Android Studio までを含めた全ての依存性を考慮していない

Version Catalog (toml) ですが、なんだか不便です。

👉 【Android Studio Flamingo】dependencies をバージョンアップデートするときに確認するべき3つの相性 hatena-bookmark