开发工作过程中的遇到的坑_填坑向

1.eglCodecCommon: writeFully: failed: Broken pipe

转自:https://stackoverflow.com/questions/23855115/genymotion-crash-after-a-few-minutes


It's not really caused by your application, so don't worry.  
It often happens when you computer goes in sleep mode and when you come back Genymotion will throw this exception (it happens to me very often).  

In your specific case sounds like the device goes in sleep mode so a way to fix it is simply to enable "Always stay awake" in developers options.  

问题不是出自应用程序,而是模拟器或者模拟器与AS的连接问题(adb),重启模拟器即可解决

 

2.sever's certificate is not trusted

打开项目时,总是弹出警告框

解决办法

https://blog.csdn.net/u014764233/article/details/80046514

点击android studio左上角的File > Settings > Tools > Server Certificates > Accept non-trusted certificates automatically

意思为自动接受不可信的证书,将不再弹窗提醒。

 

3.    error inflating class imageview 报错

资源文件报错

有可能是资源文件的问题,建议更换资源文件排查

还有就是设置imageView图片时,用的是background属性,应该更正为app:srcCompat属性

 

4. IllegalStateException: Can not perform this action after onSaveInstanceState

更多参考 https://blog.csdn.net/edisonchang/article/details/49873669

我的问题是因为调用 popBackStack()在mainActivity中的onDestory()方法

正常的做法是在onBackPressed()中调用.改正后目前没有再次出现类似告警,原理待发现.

 popBackStack()更多查阅https://blog.csdn.net/qq_16247851/article/details/52793061

 

5 This Handler class should be static or leaks might occur (anonymous android.os.Handler)

更多参考 https://blog.csdn.net/banxiali/article/details/51494842

https://www.jianshu.com/p/0a274564a4b1

解决办法,实现一个静态类继承Hanlder,内部持有一个活动的弱引用,在使用的时候,获得当前活动的弱引用

 

6 butterknife注解框架异常--ArrayIndexOutOfBoundsException

原因是因为xml布局中,有控件命名不规范,出现连续的下划线__

 

7butterknife编译异常

java.lang.RuntimeException: Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.
  - butterknife-compiler-8.8.1.jar (com.jakewharton:butterknife-compiler:8.8.1)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.
 

提示了两种解决方式

一个是添加显式的编译器声明

//添加依赖
implementation 'com.jakewharton:butterknife:8.5.1'
//添加编译器的显式声明
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

另一个就是在defaultConfig中声明

 defaultConfig {
        ...
        //添加如下配置就OK了
        javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
    }

但是这个办法,注释中说以后的未来会删除这个选项,推荐采用第一种办法

 

8 泛型转化过程中一直提示uncheck cast

FragmentClickedInterface<InquireShuttle> callback= (FragmentClickedInterface<InquireShuttle>) getActivity();

 

添加注解消除

9 zygote: Dex checksum does not match for dex

zygote:Dex校验和与dex不匹配

这是由于我自己在项目建立后自己改了project结构目录里的根包名,但是AndroidManifest和gradle文件中的包名信息没有修改一致

需要手动修改两个地方

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.*********">

 

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.*********"
        minSdkVersion 16
    ......
}

 

10 添加Glide依赖报错

No static method getFont...

https://blog.csdn.net/huangxiaoguo1/article/details/78871905

查询后发现是因为Glide4中引用到了V7版本与我自己的V7版本不一致造成

要么改变自己的V7版本到最新

要么Glide降级,用老的版本,问题解决

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值