Android 常见错误以及解决方法

01、

解决方案:

Gradle的一个Bug,解决办法是,删除项目根目录的.gradle文件夹,然后Clean ,Rebulid。 

02、git 提交代码无法提交问题

Unable to create 'D:/work/******/.git/index.lock': File exists. 
If no other git process is currently running, this probably means a git process crashed in this repository earlier.
 Make sure no other git process is running and remove the file manually to continue.

解决方案:找到相应位置的 index.lock 删除即可

03、

java.lang.ClassCastException: android.support.v7.widget.AppCompatTextView cannot be cast to android.widget.EditText

类型转换异常,在这里是TextView转换成EditText,粗心导致崩溃。

解决方案:类型替换就好了

04、see the compiler error output for details

Error:Execution failed for task ':xxxx:compileStDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

这个花了比较多的时间来排查问题,在网络上也找了几种方式尝试了一下都没有解决,在这里总结一下自己解决的方式。

 

错误原因:

 

@Autowired(name = ParamKeys.ACTIVITY_XXX)
private XxxBean mXxxBean;

通过ARouter 接收参数时,多了一个 private 属性,从而出现这种错误。

问题解决:

去掉 private 属性,编译正常。

注意:这类问题出现的原因,主要是自己的编码的问题,应该仔细检查自己出现问题的代码,看是否有比较特殊的。另外studio 右下角有一个 Gradle Console ,在这里可以看看具体哪里出现问题,会给你具体位置。如下:

错误: ARouter::Compiler An exception is encountered, 
[The inject fields CAN NOT BE 'private'!!! please check field [mXxxxBean] in class [xxx.xxxx.xxxxxActivity]]

 

 

 

 

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值