Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于booster-transform-shrink移除常量的问题 #17

Closed
DingProg opened this issue May 7, 2019 · 4 comments
Closed

关于booster-transform-shrink移除常量的问题 #17

DingProg opened this issue May 7, 2019 · 4 comments

Comments

@DingProg
Copy link

DingProg commented May 7, 2019

  • 首先我接入 booster后,发现greenDao 不能正常运行,error log如下
Caused by: de.greenrobot.dao.DaoException: Could not init DAOConfig
        at de.greenrobot.dao.internal.DaoConfig.<init>(DaoConfig.java:94)
        at de.greenrobot.dao.AbstractDaoMaster.registerDaoClass(AbstractDaoMaster.java:44)
     Caused by: java.lang.NoSuchFieldException: TABLENAME
        at java.lang.Class.getField(Class.java:1601)
        at de.greenrobot.dao.internal.DaoConfig.<init>(DaoConfig.java:56)
  • 查看 错误的代码 发现反射拿TABLENAME

      `    this.tablename = (String) daoClass.getField("TABLENAME").get(null);`
    
  • 这个实体如下

public class NoteDao extends AbstractDao<Note, Long> {
    public static final String TABLENAME = "NOTE";
}
  • 查看你们的booster-transform-shrink 忽略配置属性
    booster.transform.shrink.ignores=android/,androidx/

  • 添加我的配置属性
    booster.transform.shrink.ignores={packagename}.dao.NoteDao

未生效
并问一下,移除产量的时候,配置可以采用混淆配置文件去默认配置吗?当然R文件除外

@johnsonlee
Copy link
Collaborator

规则改成这样试试:

booster.transform.shrink.ignores={packagename.replace('.', '/')}/dao/NoteDao.class

@DingProg
Copy link
Author

DingProg commented May 7, 2019

替换成
booster.transform.shrink.ignores={packagename.replace('.', '/')}/dao/*
可以了,建议在文档上注明,只能使用‘/’而不是'.,'或者组件里面做适配,感觉也可以

@johnsonlee
Copy link
Collaborator

嗯,下版在 shrink transformer 里做一下模式的兼容

@johnsonlee
Copy link
Collaborator

Booster v0.3.2 is available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants