一、描述:安装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+(可忽略,虽报错,但仍可正常运行)

Android异常与警告解决方法

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

Android异常与警告解决方法

 

三、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 [email protected] is not valid; is your activity running?

异常发生条件:

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

Android异常与警告解决方法

Android异常与警告解决方法

Android异常与警告解决方法

 

五、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代替

Android异常与警告解决方法

六、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 inflate view tag without class attribute

Android异常与警告解决方法

View大小写问题

八、编译时,Error: Duplicate resources

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

相关文章: