小编Ali*_*yan的帖子

在gradle中找不到方法:coreLibraryDesugaringEnabled

我想使用Android Studio 4.0 Canary 3

正如在功能列表中提到的那样:

Android Studio 现在支持使用多种 Java 8 语言 API,而无需为您的应用设置最低 API 级别。

在模块的 build.gradle 文件中,将此coreLibraryDesugaringEnabled带有true参数的方法添加到compileOptions对象中。

像这样:

 compileOptions {
    // Flag to enable support for the new language APIs
    coreLibraryDesugaringEnabled true
    // Sets Java compatibility to Java 8
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
Run Code Online (Sandbox Code Playgroud)

我预计它会正常工作,但会出现以下错误:

Could not find method coreLibraryDesugaringEnabled() for arguments [true] on object of type com.android.build.gradle.internal.CompileOptions.

android build.gradle

8
推荐指数
5
解决办法
4554
查看次数

LiveData 与 Observable 数据对象

根据LiveData 文档,其中一项功能被设计为使用可观察模式通知数据更改。(除此之外,LiveData 还提供了许多其他有前途的功能)

另一方面,Observable data object基于其文档的数据库能够通知其他人其数据的变化。

结果,这两个功能看起来是相同的。

问题是:

LiveData与其他功能一起使用不是更好吗?

android-databinding android-livedata android-jetpack

4
推荐指数
1
解决办法
5202
查看次数