【问题标题】:DBFlow and Butterknife ConflictDBFlow 和 Butterknife 冲突
【发布时间】:2017-03-08 18:47:03
【问题描述】:

有人知道如何使用 DBFlow 和 ButterKnife 而不发生冲突吗?当我一起使用这些库时,我遇到了以下问题:

“原因:com.raizlabs.android.dbflow.structure.InvalidDBConfiguration:模型对象:br.com.test.Name 未在数据库中注册。您忘记注释了吗?”

我正确实现了.java中的注解,怎么看:

   package br.com.test;

   import com.raizlabs.android.dbflow.annotation.Column;
   import com.raizlabs.android.dbflow.annotation.PrimaryKey;
   import com.raizlabs.android.dbflow.annotation.Table;
   import com.raizlabs.android.dbflow.structure.BaseModel;

   @Table(database = DatabaseInfo.class)
   public class Name extends BaseModel {

       @Column
       @PrimaryKey
       long id;

       @Column
       String value;

       public Name() {}
   }

当我从 .gradle 和 .java 中删除 ButterKnife 依赖项时,相同的代码可以正常工作。

有人可以帮帮我吗?

【问题讨论】:

  • 你用的是最新的黄油刀吗?
  • 嗨 Rod_Algonquin 我使用的是 8.4.0 版本。 “编译'com.jakewharton:butterknife:8.4.0'”,它不是最新版本
  • 尝试使用 8.5.1
  • 你是对的 Rod_Algonquin,我改到 8.5.1 并且工作正常。 ButterKnife 也像 DBFlow 一样使用 annotationProcessor 而不是 apt。我认为当我们将 apt 一起使用 annotationProcessor 时存在一些冲突。非常感谢您的回答。

标签: java android orm butterknife dbflow


【解决方案1】:

正如 Road_Algonquin 对我说的,我们必须检查 ButterKnife 版本。当我改变时:

//FROM

apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.jakewharton:butterknife:8.4.0'

//TO

annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.jakewharton:butterknife:8.5.1'

工作正常

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-22
    • 2018-05-09
    • 1970-01-01
    • 2019-08-27
    • 2012-09-10
    • 2012-08-24
    相关资源
    最近更新 更多