android编译警告,Android异常与警告解决方法

一、描述:安装APPdebug版本app-debug.apk报错,找不到Application类(DroidPlannerApp)

错误:java.lang.RuntimeException: Unable to instantiate application com.luoguopeng.ldrone.DroidPlannerApp: java.lang.ClassNotFoundException: Didn't find class "com.luoguopeng.ldrone.DroidPlannerApp"

原因:Instant Run tries to do hot swapping of your code; this causes the application class to be moved.

解决:To disable Instant Run Go to File --> Settings--> Build,Execution,Deployment -->Instant Run ---> uncheck "Enable instant run"

二、usage of api documented as @since 1.8+(可忽略,虽报错,但仍可正常运行)

81397165e67846a763695cdda8cf9213.png

解决方法:对应Module的build.gradle文件里添加

3334289c565587ddfe215a7721252b3c.png

三、Error:Error converting bytecode to dex:

Cause: com.android.dex.DexException: Multiple dex files define

原因:项目中存在相同的jar包,导致运行失败

解决方法:

AndroidStudio--Error converting bytecode to dex

Android Studio com.android.dex.DexException: Multiple dex files define(重复引用包)

AndroidStudio中多个Module依赖同一个jar的解决方案

四、WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@d76082 is not valid; is your activity running?

异常发生条件:

1.此Toast不注释;

2.在系统弹出权限申请对话框时等待1秒以上再点拒绝或允许。

1c9d570140abc30755e9930915ce41a8.png

292c1db33150a32ed6f95737397cc2b5.png

89c709670b155cb75cbd4bbdcc8b195d.png

五、java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{c444d3d position=1 id=-1, oldPos=0, pLpos:0 scrap [attachedScrap]tmpDetached no parent}

使用RecyclerView过程中,用

mAdapter.notifyItemInserted(position)

刷新数据(本人是刷新第一个数据即position为0时)会导致这个错误并程序崩溃

解决方法:这是RecyclerView的Bug,可用mAdapter.notifyDataSetChanged代替

41229484997d59d421c660c30252334c.png

六、ANR:Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 47.  Wait queue head age: 5509.4ms.)

EditorMapFragment:长按地图规划航线任务,若操作过于频繁,会出现此异常

七、Unable to inflateview tag without class attribute

d8908846972b0f544a013a1e1f67ae80.png

View大小写问题

八、编译时,Error: Duplicate resources

drawable 目录下有同名资源文件,例如a.png与a.jpg

九、The dimen "base_dpi" in values-sw300dp has no declaration in the base values folder; this can lead to crashes when the resource is queried ina configuration that does not match this qualifier

4d8feb0be18c85921b26d19dd42cc3d4.png

225f96b38977dd993dfbece4405731f1.png

解决方法:把values-swXXXdp文件夹里的dimens.xml复制一份到values文件夹下

十、Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)

35c988c6b575598e4b404f9014b59172.png

解决:gradle-wrapper.properties修改可用gradle的版本

212b7230fffdee842773e7d511d8f33a.png

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值