简体   繁体   English

在 Android 中使用 Room-Guava,找不到 ListenableFuture

[英]Using Room-Guava in Android, cannot find ListenableFuture

I'm following this: https://developer.android.com/training/data-storage/room/async-queries我正在关注这个: https://developer.android.com/training/data-storage/room/async-queries

I'm trying to use ListenableFuture from Guava, so I included androidx.room:room-guava but Android Studio keeps complaining that " Cannot resolve symbol 'ListenableFuture' " and doesn't suggest any relevant import .我正在尝试使用来自 Guava 的ListenableFuture ,所以我包含了 androidx.room:room-guava但 Android Studio 一直在抱怨“无法解析符号 'ListenableFuture' ”并且不建议任何相关的import

What is the correct import to include in Java source? Java 源中包含的正确import是什么?

Here is my code:这是我的代码:


build.gradle(:app) build.gradle(:app)

...
// Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:2.4.3"

Java DAO interface Java DAO接口

import androidx.room.Dao;
import androidx.room.Insert;

@Dao
public interface PressureMeasureDao
{
    @Insert
    public ListenableFuture<Integer> insertPressureMeasure(PressureMeasure pressureMeasure);
}

According to https://mvnrepository.com/artifact/androidx.room/room-guava/2.4.3 androidx.concurrent:concurrent-futures is a runtime dependency.根据https://mvnrepository.com/artifact/androidx.room/room-guava/2.4.3 androidx.concurrent:concurrent-futures 是运行时依赖项。 Please check if https://mvnrepository.com/artifact/androidx.concurrent/concurrent-futures is present.请检查https://mvnrepository.com/artifact/androidx.concurrent/concurrent-futures是否存在。 ListenableFuture comes from its transitive dependency https://mvnrepository.com/artifact/com.google.guava/listenablefuture/1.0 . ListenableFuture来自其传递依赖https://mvnrepository.com/artifact/com.google.guava/listenablefuture/1.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使使用 kapt 房间“找不到实现” - Room "cannot find implementation for" even with using kapt 将 Android 房间数据库与 RXJava2 一起使用时找不到符号 class EmptyResultSetException - Cannot find symbol class EmptyResultSetException when using Android Room Database with RXJava2 Android Room库错误:无法找到字段的setter。 (科特林) - Android Room library error: Cannot find setter for field. (Kotlin) 龙目岛不适用于“Android 房间”。 给出“错误:找不到字段的吸气剂” - Lombok not working with “Android room”. Gives “error: Cannot find getter for field” 房间找不到实现 - Room cannot find implementation Android Studio:房间:错误:找不到字段的吸气剂 - Android Studio: Room: error: Cannot find getter for field 找不到数据库Room的实现 - cannot find implementation for database Room 找不到字段设置器 - 将 Kotlin 与 Room 数据库一起使用 - Cannot find setter for field - using Kotlin with Room database 无法在主线程上访问数据库 - Android Room - 使用ThreadPoolExecutor - Cannot access database on the main thread - Android Room - Using ThreadPoolExecutor 无法在 kotlin (Android) 中使用 hashmap 向列表视图显示房间数据库数据 - cannot show room database data to listview using hashmap in kotlin (Android)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM