0
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 3 years have passed since last update.

AndroidでLocalDateを使おうとしてハマった

Last updated at Posted at 2021-02-12

AndroidでLocalDateを使いたくてJava 8+ API の desugar のサポートに従って以下の設定を入れた。

compileOptions {
    coreLibraryDesugaringEnabled true
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

dependencies {
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1'
}

そして、ビルドして、実行すると……クラッシュ!

なんでかな〜と思ってググっていたら、
https://issuetracker.google.com/issues/157681341

Could you have a quick go at trying to have the isCoreLibraryDesugaringEnabled enabled just for the main app module

と書いてあった。
なるほど、自分が↑の設定を入れたのはaarモジュールだった。
アプリのメインモジュールの方にも同じ設定を入れたら、実行できた!

モジュールを細かく分けてAndroidアプリをビルドしている方はお気をつけを〜

0
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
0
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?