1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Android】最小APIが低くてもJava 8の機能を使用する方法

Posted at

はじめに

ツール系のアプリケーションや歴史のあるプロジェクトでなかなか最小バージョンをあげられないプロジェクトが一定数ありますよね。
そんな時にjava.timeなどに含まれるLocalDateTimeなどの機能を使用しようとすると最小を26以上にしろと怒られるケースがあるかと思います。
本日は最小APIが満たされていなくてもJava8の機能を使用するための設定を備忘録的にまとめておこうと思います。

設定方法

設定は非常にシンプルで、app/build.gradleに以下設定を追記するだけです。

app/build.gradle
coreLibraryDesugaringEnabled true

設定は以上になります、上記に関する情報は公式にも記載がありますので、こちらも参考にしていただけたらと思います。

さいごに

最小バージョンをあげたいけど上げられないという状況はエンジニアにとってフラストレーションが溜まる原因になりますので、本当に厳しいかどうかは適時相談していきたいところですね。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?