首页 新闻 会员 周边

Error:Execution failed for task ':app:greendao'.

0
悬赏园豆:20 [已关闭问题] 关闭于 2017-12-12 11:40

Error:Execution failed for task ':app:greendao'.
> Can't replace constructor in I:\Android\PrintItem\app\src\main\java\zhu\com\printitem\domain\Tb_Cbo_CLDL.java:14 with generated version.
If you would like to keep it, it should be explicitly marked with @Keep annotation.
Otherwise please mark it with @Generated annotation

 

弄了好久都解决不了,那个大神帮帮忙!!!!

问题补充:

我今天尝试把原来之前生成的dao类给删了重新写了Tb_Cbo_CLDL就解决问题了!

Xiao_野猪的主页 Xiao_野猪 | 初学一级 | 园豆:159
提问于:2017-12-11 16:52
< >
分享
所有回答(2)
0

试试把引用从

import org.greenrobot.greendao.annotation.*;

改成下面具体的

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToOne;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Generated;
BUTTERAPPLE | 园豆:3190 (老鸟四级) | 2017-12-11 16:58

不行

 

支持(0) 反对(0) Xiao_野猪 | 园豆:159 (初学一级) | 2017-12-11 17:04

@Xiao_野猪: 我怎么感觉是你版本的问题,你把版本都升级到最新试试。

支持(0) 反对(0) BUTTERAPPLE | 园豆:3190 (老鸟四级) | 2017-12-11 17:12

@BUTTERAPPLE: 刚刚尝试了一下还是出错!!

支持(0) 反对(0) Xiao_野猪 | 园豆:159 (初学一级) | 2017-12-11 19:51
0

因为菜鸟所以这个问题弄了挺久的,这个是时间的问题。

因为springMVC没有没办法把字符串转换成日期类型,所以需要自定义参数绑定

前端控制器接收到请求后,找到注解形式的处理器适配器

所以我在spring-mvc.xml的配置文件中加了这些写代码

<!-- 日期转换 必须放在<mvc:annotation-driven />前面 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"></bean>
<!-- 注解方式 -->
<mvc:annotation-driven conversion-service="conversionService">
</mvc:annotation-driven>
<!-- 配置日期转换器 -->
<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
<property name="converters">
<set>
<bean class="zhu.util.DateConverter"></bean>
</set>
</property>
</bean>

然后再创建一个时间工具类

package zhu.unitl;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;
/**
* 时间处理
* @author XiaoZhu
*
*/
public class DateConverter implements Converter<String, Date>{

@Override
public Date convert(String source) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
return simpleDateFormat.parse(source);

} catch (Exception e) {
e.printStackTrace();
}
return null;
}

}

这些都是上网找了好久的

Xiao_野猪 | 园豆:159 (初学一级) | 2017-12-12 11:37
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册