【发布时间】:2018-08-09 20:02:24
【问题描述】:
希望你能帮帮我,我正在尝试在我的android项目中实现autovalue,但是代码没有生成。
我在 app/build.gradle 中添加了:
provided 'com.google.auto.value:auto-value:1.5.3'
annotationProcessor 'com.google.auto.value:auto-value:1.5.3'
annotationProcessor 'com.ryanharter.auto.value:auto-value-gson:0.7.0'
compile 'com.ryanharter.auto.value:auto-value-gson-annotations:0.7.0'
在编译器中的android studio 3.0默认设置>注释处理器中,我选中了启用注释处理,并选择了从项目类路径中获取处理器。
我这样创建了 AutoValueGsonFactory 类:
import com.google.gson.TypeAdapterFactory;
import com.ryanharter.auto.value.gson.GsonTypeAdapterFactory;
@GsonTypeAdapterFactory
public abstract class AutoValueGsonFactory implements TypeAdapterFactory {
// Static factory method to access the package
// private generated implementation
public static TypeAdapterFactory create() {
return new AutoValueGson_AutoValueGsonFactory();
}
}
然后我点击 Build > Rebuild Project
但是不起作用,抛出这个错误:
错误:(16, 20) 错误:找不到符号类 AutoValueGson_AutoValueGsonFactory
我做错了什么或我错过了什么?
【问题讨论】:
标签: android auto-value