笔记 -- 07 -- 常见错误以及解决方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zp0119/article/details/78307861

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]]





猜你喜欢

转载自blog.csdn.net/zp0119/article/details/78307861
今日推荐